diff --git a/README.md b/README.md index b7f459a..54ba7f5 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,3 @@ -# 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 +[docs](./template/README.md) \ 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; + } + ]; + }; + }; +};