This commit is contained in:
2026-02-25 23:58:47 +00:00
parent 5325aba1cf
commit eb5b621962
7 changed files with 213 additions and 81 deletions

55
flake.lock generated
View File

@@ -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"
} }

127
flake.nix
View File

@@ -1,64 +1,81 @@
{ {
description = "Stationette nix config"; description = "Stationette nix config";
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 = {
self, self,
nixpkgs, nixpkgs,
nixpkgs-unstable, nixpkgs-unstable,
home-manager, home-manager,
... impermanence,
} @ inputs: let disko,
lib = nixpkgs.lib; ...
# Supported systems for your flake packages, shell, etc. } @ inputs: let
# "aarch64-linux" lib = nixpkgs.lib;
# "i686-linux" # Supported systems for your flake packages, shell, etc.
# "x86_64-linux" # "aarch64-linux"
# "aarch64-darwin" # "i686-linux"
# "x86_64-darwin" # "x86_64-linux"
system = "x86_64-linux"; # "aarch64-darwin"
pkgs = nixpkgs.legacyPackages.${system}; # "x86_64-darwin"
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system}; system = "x86_64-linux";
in { pkgs = nixpkgs.legacyPackages.${system};
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
in {
# NixOS configuration entrypoint # NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#stationette' # Available through 'nixos-rebuild --flake .#stationette'
nixosConfigurations = { nixosConfigurations = {
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;
# Standalone home-manager configuration entrypoint inherit inputs;
homeConfigurations = { };
chris = home-manager.lib.homeManagerConfiguration { };
inherit pkgs; }
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
];
};
}; };
};
} }

View File

@@ -7,6 +7,7 @@
... ...
}: { }: {
imports = [ imports = [
inputs.impermanence.nixosModules.home-manager.impermanence
./user ./user
]; ];

View 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
View 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";
};
};
};
};
};
};
};
};
}

View File

@@ -1,13 +1,34 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
boot = { boot = {
#kernelParams = ["nohibernate" "ipv6.disable=1"]; loader = {
#tmp.cleanOnBoot = true; systemd-boot.enable = true;
# supportedFilesystems = ["ntfs"]; efi.canTouchEfiVariables = true;
loader = { };
systemd-boot.enable = true; initrd.postDeviceCommands = lib.mkAfter ''
efi.canTouchEfiVariables = true; 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
'';
}; };
};
} }

View 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"
]
};
}