disko
This commit is contained in:
55
flake.lock
generated
55
flake.lock
generated
@@ -1,25 +1,24 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"firefox-addons": {
|
"disko": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs-unstable"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "pkgs/firefox-addons",
|
"lastModified": 1768920986,
|
||||||
"lastModified": 1771732978,
|
"narHash": "sha256-CNzzBsRhq7gg4BMBuTDObiWDH/rFYHEuDRVOwCcwXw4=",
|
||||||
"narHash": "sha256-o7gZh/eXFkEEmzwlBdIbgCJhmdlqQhOhVjudqgsIefg=",
|
"owner": "nix-community",
|
||||||
"owner": "rycee",
|
"repo": "disko",
|
||||||
"repo": "nur-expressions",
|
"rev": "de5708739256238fb912c62f03988815db89ec9a",
|
||||||
"rev": "18226106e18bc40cce99d436ee741a946f1888f6",
|
"type": "github"
|
||||||
"type": "gitlab"
|
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"dir": "pkgs/firefox-addons",
|
"owner": "nix-community",
|
||||||
"owner": "rycee",
|
"ref": "latest",
|
||||||
"repo": "nur-expressions",
|
"repo": "disko",
|
||||||
"type": "gitlab"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"home-manager": {
|
"home-manager": {
|
||||||
@@ -29,20 +28,39 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1714043624,
|
"lastModified": 1772020340,
|
||||||
"narHash": "sha256-Xn2r0Jv95TswvPlvamCC46wwNo8ALjRCMBJbGykdhcM=",
|
"narHash": "sha256-aqBl3GNpCadMoJ/hVkWTijM1Aeilc278MjM+LA3jK6g=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "86853e31dc1b62c6eeed11c667e8cdd0285d4411",
|
"rev": "36e38ca0d9afe4c55405fdf22179a5212243eecc",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"ref": "release-23.11",
|
"ref": "release-25.11",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"type": "github"
|
"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": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1771903837,
|
"lastModified": 1771903837,
|
||||||
@@ -77,8 +95,9 @@
|
|||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"firefox-addons": "firefox-addons",
|
"disko": "disko",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
|
"impermanence": "impermanence",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nixpkgs-unstable": "nixpkgs-unstable"
|
"nixpkgs-unstable": "nixpkgs-unstable"
|
||||||
}
|
}
|
||||||
|
|||||||
41
flake.nix
41
flake.nix
@@ -4,12 +4,19 @@
|
|||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
|
||||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
home-manager.url = "github:nix-community/home-manager/release-23.11";
|
impermanence = {
|
||||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
url = "github:nix-community/impermanence";
|
||||||
firefox-addons = {
|
inputs.nixpkgs.follows = "";
|
||||||
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
|
inputs.home-manager.follows = "";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
};
|
||||||
|
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 = {
|
outputs = {
|
||||||
@@ -17,6 +24,8 @@
|
|||||||
nixpkgs,
|
nixpkgs,
|
||||||
nixpkgs-unstable,
|
nixpkgs-unstable,
|
||||||
home-manager,
|
home-manager,
|
||||||
|
impermanence,
|
||||||
|
disko,
|
||||||
...
|
...
|
||||||
} @ inputs: let
|
} @ inputs: let
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
@@ -36,13 +45,21 @@
|
|||||||
stationette = nixpkgs.lib.nixosSystem {
|
stationette = nixpkgs.lib.nixosSystem {
|
||||||
modules = [
|
modules = [
|
||||||
./system/configuration.nix
|
./system/configuration.nix
|
||||||
#home-manager.nixosModules.home-manager {
|
disko.nixModules.disko
|
||||||
# home-manager.users.chris = import ./home;
|
import ./system/disko.nix
|
||||||
# home-manager.extraSpecialArgs = {
|
{
|
||||||
# inherit pkgs-unstable;
|
imports = [
|
||||||
# inherit inputs;
|
impermanence.nixModules.impermanence
|
||||||
# };
|
home-manager.nixModules.home-manager
|
||||||
#}
|
];
|
||||||
|
home-manager = {
|
||||||
|
users.chris = import ./home;
|
||||||
|
extraSpecialArgs = {
|
||||||
|
inherit pkgs-unstable;
|
||||||
|
inherit inputs;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
imports = [
|
imports = [
|
||||||
|
inputs.impermanence.nixosModules.home-manager.impermanence
|
||||||
./user
|
./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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -2,12 +2,33 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
boot = {
|
boot = {
|
||||||
#kernelParams = ["nohibernate" "ipv6.disable=1"];
|
|
||||||
#tmp.cleanOnBoot = true;
|
|
||||||
# supportedFilesystems = ["ntfs"];
|
|
||||||
loader = {
|
loader = {
|
||||||
systemd-boot.enable = true;
|
systemd-boot.enable = true;
|
||||||
efi.canTouchEfiVariables = 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