From 487416faafa15c3be10291d00dcd72a9d94df479 Mon Sep 17 00:00:00 2001 From: Vivian Roest Date: Sat, 8 Oct 2022 16:34:25 +0200 Subject: [PATCH] add iso --- .github/workflows/nixos.yml | 22 +++++++++++ flake.lock | 37 +++++++++++++++++++ flake.nix | 16 +++++++- nixos/.gitignore | 1 - nixos/hosts/thalassa/null/configuration.nix | 2 + .../thalassa/null/hardware-configuration.nix | 4 +- nixos/iso.nix | 11 ++++++ util.nix => nixos/util.nix | 0 8 files changed, 90 insertions(+), 3 deletions(-) delete mode 100644 nixos/.gitignore create mode 100644 nixos/iso.nix rename util.nix => nixos/util.nix (100%) diff --git a/.github/workflows/nixos.yml b/.github/workflows/nixos.yml index 615e8a2e..a8f8948c 100644 --- a/.github/workflows/nixos.yml +++ b/.github/workflows/nixos.yml @@ -5,6 +5,28 @@ on: branches: [main] jobs: + build-iso: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.2 + + - name: "Install Nix ❄️" + uses: cachix/install-nix-action@v15 + + - name: "Install Cachix ❄️" + uses: cachix/cachix-action@v10 + with: + name: 0x76-infra + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + + - name: "Check NixOS Flake ❄️" + run: | + nix build '.#iso' + - uses: actions/upload-artifact@v3 + with: + name: nixos-iso + retention-days: 3 + path: result/iso/*.iso build-null: runs-on: ubuntu-latest steps: diff --git a/flake.lock b/flake.lock index df3ef1cc..ca48fde5 100644 --- a/flake.lock +++ b/flake.lock @@ -665,6 +665,42 @@ "type": "indirect" } }, + "nixlib": { + "locked": { + "lastModified": 1636849918, + "narHash": "sha256-nzUK6dPcTmNVrgTAC1EOybSMsrcx+QrVPyqRdyKLkjA=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "28a5b0557f14124608db68d3ee1f77e9329e9dd5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixos-generators": { + "inputs": { + "nixlib": "nixlib", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660727616, + "narHash": "sha256-zYTIvdPMYMx/EYqXODAwIIU30RiEHqNHdgarIHuEYZc=", + "owner": "nix-community", + "repo": "nixos-generators", + "rev": "adccd191a0e83039d537e021f19495b7bad546a1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-generators", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1664989420, @@ -848,6 +884,7 @@ "hyprpaper": "hyprpaper", "mailserver": "mailserver", "minecraft-servers": "minecraft-servers", + "nixos-generators": "nixos-generators", "nixpkgs": "nixpkgs_2", "riff": "riff", "serokell-nix": "serokell-nix", diff --git a/flake.nix b/flake.nix index f619bc8b..ec0fef59 100644 --- a/flake.nix +++ b/flake.nix @@ -37,6 +37,11 @@ mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; mailserver.inputs.nixpkgs.follows = "nixpkgs"; + + nixos-generators = { + url = "github:nix-community/nixos-generators"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = @@ -49,13 +54,14 @@ , home-manager , hyprpaper , hyprland + , nixos-generators , ... } @ inputs: let inherit (nixpkgs) lib; inherit (builtins) mapAttrs; - util = import ./util.nix inputs; + util = import ./nixos/util.nix inputs; system = "x86_64-linux"; # import and add realm to list of tags @@ -103,6 +109,14 @@ packages.${system} = { default = colmena.packages.${system}.colmena; apply-local = apply-local; + + iso = nixos-generators.nixosGenerate { + inherit system pkgs; + format = "iso"; + modules = [ + (import ./nixos/iso.nix) + ]; + }; }; # Use by running `nix develop` diff --git a/nixos/.gitignore b/nixos/.gitignore deleted file mode 100644 index 1cd791b5..00000000 --- a/nixos/.gitignore +++ /dev/null @@ -1 +0,0 @@ -result/ diff --git a/nixos/hosts/thalassa/null/configuration.nix b/nixos/hosts/thalassa/null/configuration.nix index 3426b442..f0ab3580 100644 --- a/nixos/hosts/thalassa/null/configuration.nix +++ b/nixos/hosts/thalassa/null/configuration.nix @@ -88,6 +88,8 @@ in { services.gnome.gnome-keyring.enable = true; fileSystems."/".options = [ "compress=zstd" ]; + fileSystems."/home".options = [ "compress=zstd" ]; + # Filesystem dedup services.beesd.filesystems = { root = { diff --git a/nixos/hosts/thalassa/null/hardware-configuration.nix b/nixos/hosts/thalassa/null/hardware-configuration.nix index 2b682312..527975b8 100644 --- a/nixos/hosts/thalassa/null/hardware-configuration.nix +++ b/nixos/hosts/thalassa/null/hardware-configuration.nix @@ -8,7 +8,7 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "rtsx_pci_sdmmc" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; @@ -31,8 +31,10 @@ # still possible to use this option, but it's recommended to use it in conjunction # with explicit per-interface declarations with `networking.interfaces..useDHCP`. networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wg0.useDHCP = lib.mkDefault true; # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/nixos/iso.nix b/nixos/iso.nix new file mode 100644 index 00000000..40e82839 --- /dev/null +++ b/nixos/iso.nix @@ -0,0 +1,11 @@ +{ pkgs, modulesPath, lib, ... }: { + imports = [ + "${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix" + ]; + + # use the latest Linux kernel + boot.kernelPackages = pkgs.linuxPackages_latest; + + # Needed for https://github.com/NixOS/nixpkgs/issues/58959 + boot.supportedFilesystems = lib.mkForce [ "btrfs" "reiserfs" "vfat" "f2fs" "xfs" "ntfs" "cifs" ]; +} diff --git a/util.nix b/nixos/util.nix similarity index 100% rename from util.nix rename to nixos/util.nix