From fc302ca3b50e075102dd36d46bc64e642cdf977d Mon Sep 17 00:00:00 2001 From: RTUnreal <22859658+RTUnreal@users.noreply.github.com> Date: Wed, 16 Aug 2023 15:19:40 +0200 Subject: [PATCH 1/2] feat: move flake into template --- README.md | 38 +----------------- flake.nix | 40 ++----------------- template/README.md | 37 +++++++++++++++++ .../disk-configs}/luks-lvm.nix | 0 .../disk-configs}/simple-efi.nix | 0 .../disk-configs}/zfs.nix | 0 flake.lock => template/flake.lock | 0 template/flake.nix | 40 +++++++++++++++++++ 8 files changed, 82 insertions(+), 73 deletions(-) create mode 100644 template/README.md rename {disk-configs => template/disk-configs}/luks-lvm.nix (100%) rename {disk-configs => template/disk-configs}/simple-efi.nix (100%) rename {disk-configs => template/disk-configs}/zfs.nix (100%) rename flake.lock => template/flake.lock (100%) create mode 100644 template/flake.nix diff --git a/README.md b/README.md index b7f459a..a1b0797 100644 --- a/README.md +++ b/README.md @@ -1,37 +1 @@ -# disko + nixos-anywhere workshop - -This is an example repo for nixos-anywhere and disko. -It's part of our CCC camp workshop. - -To run the interactive vm test run: - -``` -nix run github:numtide/nixos-anywhere -- --flake '.#mysystem' --vm-test -``` - -You can also install the vm on some remote system when running - -``` -nix run github:numtide/nixos-anywhere -- --flake '.#mysystem' root@192.168.0.10 -``` - - -Improve this workshop README: - -# disko + nixos-anywhere workshop - -This is an example repo for nixos-anywhere and disko. -It's part of our CCC camp workshop. - -To run the interactive vm test run: - -``` -nix run github:numtide/nixos-anywhere -- --flake '.#mysystem' --vm-test -``` - -You can also install the vm on some remote system when running - -``` -nix run github:numtide/nixos-anywhere -- --flake '.#mysystem' root@192.168.0.10 -``` - +# nixos-anywhere-workshop template \ No newline at end of file diff --git a/flake.nix b/flake.nix index 3da990b..9f074d3 100644 --- a/flake.nix +++ b/flake.nix @@ -1,40 +1,8 @@ { - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - - inputs.disko.url = "github:nix-community/disko"; - inputs.disko.inputs.nixpkgs.follows = "nixpkgs"; - - inputs.nixos-anywhere.url = "github:numtide/nixos-anywhere"; - inputs.nixos-anywhere.inputs.nixpkgs.follows = "nixpkgs"; - - outputs = { self, nixpkgs, disko, nixos-anywhere, ... }@attrs: { - packages."x86_64-linux".makeDiskImageTest = disko.lib.lib.makeDiskImage { - nixosConfig = self.nixosConfigurations.mysystem; - }; - packages."x86_64-linux".makeDiskScriptTest = disko.lib.lib.makeDiskImageScript { - nixosConfig = self.nixosConfigurations.mysystem; - }; - nixosConfigurations.mysystem = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = attrs; - modules = [ - (nixpkgs.outPath + "/nixos/modules/installer/scan/not-detected.nix") - disko.nixosModules.disko - ./disk-configs/simple-efi.nix # choose your favorite disk layout here - #./disk-configs/zfs.nix # choose your favorite disk layout here - #./disk-configs/luks-lvm.nix # choose your favorite disk layout here - { - boot.loader.grub = { - efiSupport = true; - efiInstallAsRemovable = true; - }; - boot.swraid.enable = true; - # Alternative to grub - #boot.loader.systemd-boot.enable = true; - # when installing toggle this - #boot.loader.efi.canTouchEfiVariables = false; - } - ]; + outputs = {...}: { + templates.default = { + description = "A nixos-anywhere example"; + path = ./template; }; }; } diff --git a/template/README.md b/template/README.md new file mode 100644 index 0000000..b7f459a --- /dev/null +++ b/template/README.md @@ -0,0 +1,37 @@ +# disko + nixos-anywhere workshop + +This is an example repo for nixos-anywhere and disko. +It's part of our CCC camp workshop. + +To run the interactive vm test run: + +``` +nix run github:numtide/nixos-anywhere -- --flake '.#mysystem' --vm-test +``` + +You can also install the vm on some remote system when running + +``` +nix run github:numtide/nixos-anywhere -- --flake '.#mysystem' root@192.168.0.10 +``` + + +Improve this workshop README: + +# disko + nixos-anywhere workshop + +This is an example repo for nixos-anywhere and disko. +It's part of our CCC camp workshop. + +To run the interactive vm test run: + +``` +nix run github:numtide/nixos-anywhere -- --flake '.#mysystem' --vm-test +``` + +You can also install the vm on some remote system when running + +``` +nix run github:numtide/nixos-anywhere -- --flake '.#mysystem' root@192.168.0.10 +``` + diff --git a/disk-configs/luks-lvm.nix b/template/disk-configs/luks-lvm.nix similarity index 100% rename from disk-configs/luks-lvm.nix rename to template/disk-configs/luks-lvm.nix diff --git a/disk-configs/simple-efi.nix b/template/disk-configs/simple-efi.nix similarity index 100% rename from disk-configs/simple-efi.nix rename to template/disk-configs/simple-efi.nix diff --git a/disk-configs/zfs.nix b/template/disk-configs/zfs.nix similarity index 100% rename from disk-configs/zfs.nix rename to template/disk-configs/zfs.nix diff --git a/flake.lock b/template/flake.lock similarity index 100% rename from flake.lock rename to template/flake.lock diff --git a/template/flake.nix b/template/flake.nix new file mode 100644 index 0000000..54834db --- /dev/null +++ b/template/flake.nix @@ -0,0 +1,40 @@ +{ + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + inputs.disko.url = "github:nix-community/disko"; + inputs.disko.inputs.nixpkgs.follows = "nixpkgs"; + + inputs.nixos-anywhere.url = "github:numtide/nixos-anywhere"; + inputs.nixos-anywhere.inputs.nixpkgs.follows = "nixpkgs"; + + outputs = { self, nixpkgs, disko, nixos-anywhere, ... }@attrs: { + packages."x86_64-linux".makeDiskImageTest = disko.lib.lib.makeDiskImage { + nixosConfig = self.nixosConfigurations.mysystem; + }; + packages."x86_64-linux".makeDiskScriptTest = disko.lib.lib.makeDiskImageScript { + nixosConfig = self.nixosConfigurations.mysystem; + }; + nixosConfigurations.mysystem = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = attrs; + modules = [ + (nixpkgs.outPath + "/nixos/modules/installer/scan/not-detected.nix") + disko.nixosModules.disko + ./disk-configs/simple-efi.nix # choose your favorite disk layout here + #./disk-configs/zfs.nix # choose your favorite disk layout here + #./disk-configs/luks-lvm.nix # choose your favorite disk layout here + { + boot.loader.grub = { + efiSupport = true; + efiInstallAsRemovable = true; + }; + boot.swraid.enable = true; + # Alternative to grub + #boot.loader.systemd-boot.enable = true; + # when installing toggle this + #boot.loader.efi.canTouchEfiVariables = false; + } + ]; + }; + }; +}; From d13e7a640f7a0383f140de09c1a5355328d47ead Mon Sep 17 00:00:00 2001 From: RTUnreal <22859658+RTUnreal@users.noreply.github.com> Date: Wed, 16 Aug 2023 15:31:28 +0200 Subject: [PATCH 2/2] add doc link --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a1b0797..54ba7f5 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ -# nixos-anywhere-workshop template \ No newline at end of file +# nixos-anywhere-workshop template + +[docs](./template/README.md) \ No newline at end of file