disko
This commit is contained in:
55
flake.lock
generated
55
flake.lock
generated
@@ -1,25 +1,24 @@
|
||||
{
|
||||
"nodes": {
|
||||
"firefox-addons": {
|
||||
"disko": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
"nixpkgs-unstable"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"dir": "pkgs/firefox-addons",
|
||||
"lastModified": 1771732978,
|
||||
"narHash": "sha256-o7gZh/eXFkEEmzwlBdIbgCJhmdlqQhOhVjudqgsIefg=",
|
||||
"owner": "rycee",
|
||||
"repo": "nur-expressions",
|
||||
"rev": "18226106e18bc40cce99d436ee741a946f1888f6",
|
||||
"type": "gitlab"
|
||||
"lastModified": 1768920986,
|
||||
"narHash": "sha256-CNzzBsRhq7gg4BMBuTDObiWDH/rFYHEuDRVOwCcwXw4=",
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"rev": "de5708739256238fb912c62f03988815db89ec9a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "pkgs/firefox-addons",
|
||||
"owner": "rycee",
|
||||
"repo": "nur-expressions",
|
||||
"type": "gitlab"
|
||||
"owner": "nix-community",
|
||||
"ref": "latest",
|
||||
"repo": "disko",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
@@ -29,20 +28,39 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1714043624,
|
||||
"narHash": "sha256-Xn2r0Jv95TswvPlvamCC46wwNo8ALjRCMBJbGykdhcM=",
|
||||
"lastModified": 1772020340,
|
||||
"narHash": "sha256-aqBl3GNpCadMoJ/hVkWTijM1Aeilc278MjM+LA3jK6g=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "86853e31dc1b62c6eeed11c667e8cdd0285d4411",
|
||||
"rev": "36e38ca0d9afe4c55405fdf22179a5212243eecc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-23.11",
|
||||
"ref": "release-25.11",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"impermanence": {
|
||||
"inputs": {
|
||||
"home-manager": [],
|
||||
"nixpkgs": []
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1769548169,
|
||||
"narHash": "sha256-03+JxvzmfwRu+5JafM0DLbxgHttOQZkUtDWBmeUkN8Y=",
|
||||
"owner": "nix-community",
|
||||
"repo": "impermanence",
|
||||
"rev": "7b1d382faf603b6d264f58627330f9faa5cba149",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "impermanence",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1771903837,
|
||||
@@ -77,8 +95,9 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"firefox-addons": "firefox-addons",
|
||||
"disko": "disko",
|
||||
"home-manager": "home-manager",
|
||||
"impermanence": "impermanence",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable"
|
||||
}
|
||||
|
||||
127
flake.nix
127
flake.nix
@@ -1,64 +1,81 @@
|
||||
{
|
||||
description = "Stationette nix config";
|
||||
description = "Stationette nix config";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
|
||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager/release-23.11";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
firefox-addons = {
|
||||
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
|
||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
impermanence = {
|
||||
url = "github:nix-community/impermanence";
|
||||
inputs.nixpkgs.follows = "";
|
||||
inputs.home-manager.follows = "";
|
||||
};
|
||||
home-manager.url = "github:nix-community/home-manager/release-25.11";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
disko.url = "github:nix-community/disko/latest";
|
||||
disko.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
#firefox-addons = {
|
||||
# url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
|
||||
# inputs.nixpkgs.follows = "nixpkgs";
|
||||
#};
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
nixpkgs-unstable,
|
||||
home-manager,
|
||||
...
|
||||
} @ inputs: let
|
||||
lib = nixpkgs.lib;
|
||||
# Supported systems for your flake packages, shell, etc.
|
||||
# "aarch64-linux"
|
||||
# "i686-linux"
|
||||
# "x86_64-linux"
|
||||
# "aarch64-darwin"
|
||||
# "x86_64-darwin"
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
|
||||
in {
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
nixpkgs-unstable,
|
||||
home-manager,
|
||||
impermanence,
|
||||
disko,
|
||||
...
|
||||
} @ inputs: let
|
||||
lib = nixpkgs.lib;
|
||||
# Supported systems for your flake packages, shell, etc.
|
||||
# "aarch64-linux"
|
||||
# "i686-linux"
|
||||
# "x86_64-linux"
|
||||
# "aarch64-darwin"
|
||||
# "x86_64-darwin"
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
|
||||
in {
|
||||
# NixOS configuration entrypoint
|
||||
# Available through 'nixos-rebuild --flake .#stationette'
|
||||
nixosConfigurations = {
|
||||
stationette = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
./system/configuration.nix
|
||||
#home-manager.nixosModules.home-manager {
|
||||
# home-manager.users.chris = import ./home;
|
||||
# home-manager.extraSpecialArgs = {
|
||||
# inherit pkgs-unstable;
|
||||
# inherit inputs;
|
||||
# };
|
||||
#}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Standalone home-manager configuration entrypoint
|
||||
homeConfigurations = {
|
||||
chris = home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
extraSpecialArgs = {
|
||||
inherit pkgs-unstable;
|
||||
inherit inputs;
|
||||
nixosConfigurations = {
|
||||
stationette = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
./system/configuration.nix
|
||||
disko.nixModules.disko
|
||||
import ./system/disko.nix
|
||||
{
|
||||
imports = [
|
||||
impermanence.nixModules.impermanence
|
||||
home-manager.nixModules.home-manager
|
||||
];
|
||||
home-manager = {
|
||||
users.chris = import ./home;
|
||||
extraSpecialArgs = {
|
||||
inherit pkgs-unstable;
|
||||
inherit inputs;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Standalone home-manager configuration entrypoint
|
||||
homeConfigurations = {
|
||||
chris = home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
extraSpecialArgs = {
|
||||
inherit pkgs-unstable;
|
||||
inherit inputs;
|
||||
};
|
||||
modules = [
|
||||
./home
|
||||
];
|
||||
};
|
||||
};
|
||||
modules = [
|
||||
./home
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
inputs.impermanence.nixosModules.home-manager.impermanence
|
||||
./user
|
||||
];
|
||||
|
||||
|
||||
12
home/user/impermanence.nix
Normal file
12
home/user/impermanence.nix
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
home.persistenec."/persist/home/chris" = {
|
||||
directories = [
|
||||
"Downloads"
|
||||
"Tower"
|
||||
".config/dotfiles"
|
||||
".local/share/direnv"
|
||||
".ssh"
|
||||
];
|
||||
"allowOther" = true;
|
||||
};
|
||||
}
|
||||
48
system/disko.nix
Normal file
48
system/disko.nix
Normal file
@@ -0,0 +1,48 @@
|
||||
# nix --extra-experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko ./disko.nix
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
stationette = {
|
||||
type = "disk";
|
||||
device = "/dev/sda"; # Check this with lsblk
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "512M";
|
||||
type = "EFOO";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
type = "btfs";
|
||||
extraArgs = [ "-f" ]; # Force overwrite
|
||||
subvolumes = {
|
||||
"/root" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
};
|
||||
"/nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
};
|
||||
"/persist" = {
|
||||
mountpoint = "/persist";
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
};
|
||||
"/swap" = {
|
||||
mountpoint = "/.swapvol";
|
||||
swap.swapfile.size = "8G";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,13 +1,34 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
boot = {
|
||||
#kernelParams = ["nohibernate" "ipv6.disable=1"];
|
||||
#tmp.cleanOnBoot = true;
|
||||
# supportedFilesystems = ["ntfs"];
|
||||
loader = {
|
||||
systemd-boot.enable = true;
|
||||
efi.canTouchEfiVariables = true;
|
||||
boot = {
|
||||
loader = {
|
||||
systemd-boot.enable = true;
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
initrd.postDeviceCommands = lib.mkAfter ''
|
||||
mkdir /btrfs_tmp
|
||||
mount /dev/disk/by-label/NIXOS /btrfs_tmp
|
||||
if [[ -e /btrfs_tmp/root ]]; then
|
||||
mkdir -p /btrfs_tmp/old_roots
|
||||
timestamp=$(dat +%Y-%m-%d_%H-%M-%S)
|
||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||
fi
|
||||
|
||||
delete_subvolume_recursively() {
|
||||
IFS=$'\n'
|
||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9 -d ' '); do
|
||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||
done
|
||||
btrfs subvolume delete "$1"
|
||||
}
|
||||
|
||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
||||
delete_subvolume_recursively "$i"
|
||||
done
|
||||
|
||||
btrfs subvolume create /btrfs_tmp/root
|
||||
umount /btrfs_tmp
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
14
system/modules/impermanenc.nix
Normal file
14
system/modules/impermanenc.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
environment.persistence."/persist" = {
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
"/var/log"
|
||||
"/var/lib/bluetooth"
|
||||
"/var/lib/networkmanager"
|
||||
"/etc/ssh"
|
||||
];
|
||||
files = [
|
||||
"/etc/machine-id"
|
||||
]
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user