nixos-configs/flake.nix

275 lines
7.8 KiB
Nix
Raw Normal View History

2023-10-08 14:57:57 +00:00
{
description = "My NixOS configuration";
inputs = {
2024-06-04 19:21:38 +00:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
2023-10-09 09:25:17 +00:00
nur.url = "github:nix-community/NUR";
2024-02-18 21:05:23 +00:00
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
stylix.url = "github:pizzapim/stylix/release-24.05";
2024-10-26 18:32:37 +00:00
treefmt-nix.url = "github:numtide/treefmt-nix";
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-02-18 21:05:23 +00:00
2023-10-08 16:03:14 +00:00
home-manager = {
2024-06-04 19:21:38 +00:00
url = "github:nix-community/home-manager?ref=release-24.05";
2023-10-08 16:03:14 +00:00
inputs.nixpkgs.follows = "nixpkgs";
};
2024-02-18 21:05:23 +00:00
2024-01-29 20:05:48 +00:00
lanzaboote = {
url = "github:nix-community/lanzaboote/v0.3.0";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-artwork = {
type = "git";
url = "https://github.com/NixOS/nixos-artwork.git";
flake = false;
};
2024-06-15 14:20:03 +00:00
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-10-26 09:59:32 +00:00
# nixpkgs-cosmic.follows = "nixos-cosmic/nixpkgs-stable";
nixos-cosmic = {
url = "github:lilyinstarlight/nixos-cosmic";
inputs.nixpkgs-stable.follows = "nixpkgs";
};
2023-10-08 14:57:57 +00:00
};
2023-11-05 17:49:51 +00:00
2024-10-26 18:33:47 +00:00
outputs = {
self,
nixpkgs,
...
} @ inputs: let
supportedSystems = [
"x86_64-linux"
"i686-linux"
"aarch64-linux"
];
forAllSystems' = nixpkgs.lib.genAttrs;
forAllSystems = forAllSystems' supportedSystems;
pkgsForSystem = system:
import nixpkgs {
inherit system;
};
2024-10-26 18:32:37 +00:00
2024-10-26 18:33:47 +00:00
treefmtEval = forAllSystems (
system: inputs.treefmt-nix.lib.evalModule (pkgsForSystem system) ./treefmt.nix
);
2024-10-26 18:32:37 +00:00
2024-10-26 18:33:47 +00:00
mkNixosSystem = {
extraModule,
nixpkgs' ? nixpkgs,
useDefaultConfiguration ? true,
}:
nixpkgs'.lib.nixosSystem rec {
system = "x86_64-linux";
2024-06-09 20:00:47 +00:00
specialArgs = {
inherit inputs system;
flake = self;
};
2024-10-26 18:33:47 +00:00
modules =
[
extraModule
]
++ nixpkgs'.lib.optional useDefaultConfiguration ./nixos;
};
2024-10-26 18:33:47 +00:00
in {
formatter = forAllSystems (system: (treefmtEval.${system}.config.build.wrapper));
nixosConfigurations = {
x260 = mkNixosSystem {
extraModule = {
pkgs,
lib,
...
}: {
imports = [inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x260];
2024-10-26 18:32:37 +00:00
2024-10-26 18:33:47 +00:00
config = {
pim.lanzaboote.enable = true;
networking.hostName = "x260";
2024-10-26 18:33:47 +00:00
fprintd = {
enable = true;
2024-05-16 16:48:46 +00:00
2024-10-26 18:33:47 +00:00
tod = {
2024-05-16 16:48:46 +00:00
enable = true;
2024-10-26 18:33:47 +00:00
driver = pkgs.libfprint-2-tod1-vfs0090;
2024-05-16 16:48:46 +00:00
};
};
2024-10-26 18:33:47 +00:00
swapDevices = [{device = "/dev/disk/by-uuid/6028bf52-404d-4143-9cb0-9b06cd60a373";}];
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "rtsx_pci_sdmmc"];
};
};
};
2024-10-26 18:33:47 +00:00
x201 = mkNixosSystem {
extraModule = {
pkgs,
lib,
...
}: {
imports = [inputs.disko.nixosModules.disko];
config = {
networking.hostName = "x201";
boot.initrd.availableKernelModules = ["ehci_pci" "ahci" "usb_storage"];
disko.devices = {
disk = {
sda = {
device = "/dev/sda";
type = "disk";
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02"; # for grub MBR
priority = 1; # Needs to be first partition
};
2024-10-26 09:59:32 +00:00
2024-10-26 18:33:47 +00:00
pv_os = {
size = "100%";
2024-10-26 09:59:32 +00:00
2024-10-26 18:33:47 +00:00
content = {
type = "lvm_pv";
vg = "vg_os";
};
};
};
};
};
2024-10-26 18:33:47 +00:00
};
2024-10-26 18:33:47 +00:00
lvm_vg.vg_os = {
type = "lvm_vg";
2024-10-26 18:33:47 +00:00
lvs = {
swap = {
size = "3GB";
content.type = "swap";
};
2024-10-26 18:33:47 +00:00
root = {
size = "100%FREE";
2024-10-26 18:33:47 +00:00
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
mountOptions = ["defaults"];
};
};
};
};
};
2024-10-26 18:33:47 +00:00
};
2024-10-26 09:59:32 +00:00
};
2024-10-26 18:33:47 +00:00
};
2024-10-26 09:59:32 +00:00
2024-10-26 18:33:47 +00:00
sue-cosmic = mkNixosSystem {
useDefaultConfiguration = false;
extraModule = {...}: {
imports = [
inputs.nixos-hardware.nixosModules.dell-xps-13-9310
inputs.nixos-cosmic.nixosModules.default
./modules/nixos/lanzaboote.nix
];
2024-10-26 09:59:32 +00:00
2024-10-26 18:33:47 +00:00
config = {
nixpkgs.config.allowUnfree = true;
nix.settings = {
substituters = ["https://cosmic.cachix.org/"];
trusted-public-keys = ["cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="];
};
2024-10-26 09:59:32 +00:00
2024-10-26 18:33:47 +00:00
users = {
users.pim = {
isNormalUser = true;
extraGroups = ["wheel" "docker" "input" "wireshark" "dialout"];
};
};
2024-10-26 09:59:32 +00:00
2024-10-26 18:33:47 +00:00
services.desktopManager.cosmic.enable = true;
services.displayManager.cosmic-greeter.enable = true;
2024-05-16 16:48:46 +00:00
2024-10-26 18:33:47 +00:00
pim.lanzaboote.enable = true;
networking.hostName = "xps-9315";
swapDevices = [{device = "/dev/disk/by-uuid/96a43c35-0174-4e92-81f0-168a5f601f0b";}];
2024-10-26 09:59:32 +00:00
2024-10-26 18:33:47 +00:00
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/31638735-5cc4-4013-8037-17e30edcbb0a";
fsType = "ext4";
2024-10-26 09:59:32 +00:00
};
2024-10-26 18:33:47 +00:00
"/boot" = {
device = "/dev/disk/by-uuid/560E-F8A2";
fsType = "vfat";
options = ["fmask=0022" "dmask=0022"];
};
2024-10-26 09:59:32 +00:00
};
2024-10-26 18:33:47 +00:00
boot.initrd.luks.devices."luks-8ffd3129-4908-4209-98c4-4eb68a35c494".device = "/dev/disk/by-uuid/8ffd3129-4908-4209-98c4-4eb68a35c494";
boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "vmd" "nvme" "usb_storage"];
};
2024-10-26 09:59:32 +00:00
};
2024-10-26 18:33:47 +00:00
};
2024-10-26 09:59:32 +00:00
2024-10-26 18:33:47 +00:00
sue = mkNixosSystem {
extraModule = {...}: {
imports = [inputs.nixos-hardware.nixosModules.dell-xps-13-9310];
2024-05-16 16:48:46 +00:00
config = {
pim.lanzaboote.enable = true;
networking.hostName = "xps-9315";
2024-10-26 18:33:47 +00:00
swapDevices = [{device = "/dev/disk/by-uuid/96a43c35-0174-4e92-81f0-168a5f601f0b";}];
2024-05-16 16:48:46 +00:00
fileSystems = {
2024-10-26 18:33:47 +00:00
"/" = {
device = "/dev/disk/by-uuid/31638735-5cc4-4013-8037-17e30edcbb0a";
fsType = "ext4";
};
2024-05-16 16:48:46 +00:00
2024-10-26 18:33:47 +00:00
"/boot" = {
device = "/dev/disk/by-uuid/560E-F8A2";
fsType = "vfat";
options = ["fmask=0022" "dmask=0022"];
};
2024-05-16 16:48:46 +00:00
};
2024-10-26 09:59:32 +00:00
nix.settings = {
2024-10-26 18:33:47 +00:00
substituters = ["https://cosmic.cachix.org/"];
trusted-public-keys = ["cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="];
2024-10-26 09:59:32 +00:00
};
2024-05-16 16:48:46 +00:00
boot.initrd.luks.devices."luks-8ffd3129-4908-4209-98c4-4eb68a35c494".device = "/dev/disk/by-uuid/8ffd3129-4908-4209-98c4-4eb68a35c494";
2024-10-26 18:33:47 +00:00
boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "vmd" "nvme" "usb_storage"];
2024-10-26 18:24:13 +00:00
# hardware.ipu6 = {
# enable = true;
# platform = "ipu6ep";
# };
2024-05-16 16:48:46 +00:00
};
2024-10-26 09:59:32 +00:00
};
2024-05-16 16:48:46 +00:00
};
2023-10-08 14:57:57 +00:00
};
2024-10-26 18:33:47 +00:00
};
2023-10-08 14:57:57 +00:00
}