Last active
June 4, 2021 06:09
-
-
Save jmettes/abc57a018be70efed9876f5529ff8a1c to your computer and use it in GitHub Desktop.
Revisions
-
jmettes revised this gist
Oct 28, 2019 . 1 changed file with 7 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,19 +9,13 @@ # add the automated installation files environment.etc = { "install.sh" = { source = ./install.sh; mode = "0700"; }; "closure-nix-store-path.txt" = { source = ./closure-nix-store-path.txt; }; "system" = { source = ./system; }; -
jmettes created this gist
Oct 28, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ nix-build --attr system "./nixos.nix" -o result-closure readlink -f result-closure > closure-nix-store-path.txt rm -r system mkdir system nix copy ./result-closure --to file://./system This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ nix-build '<nixpkgs/nixos>' -A config.system.build.isoImage -I nixos-config=iso.nix -o result-iso This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ { config, pkgs, ... }: { imports = [ ./hardware-configuration.nix ]; boot.loader.grub.device = "/dev/sda"; services.openssh = { enable = true; permitRootLogin = "no"; }; networking = { defaultGateway = { address = "192.168.1.1"; interface = "enp3s0"; }; interfaces.enp3s0 = { useDHCP = false; ipv4.addresses = [{ address = "192.168.1.2"; prefixLength = 24; }]; }; nameservers = ["8.8.8.8" "8.8.4.4"]; }; users.users.myuser = { isNormalUser = true; extraGroups = [ "wheel" ]; password = "mypassword"; }; environment.systemPackages = [ pkgs.vim ]; system.stateVersion = "19.03"; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ { config, lib, pkgs, ... }: { imports = [ ]; boot.initrd.availableKernelModules = [ "ata_piix" "ohci_pci" "sd_mod" "sr_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; fileSystems."/" = { device = "/dev/disk/by-label/nixos"; fsType = "ext4"; }; swapDevices = [ ]; nix.maxJobs = lib.mkDefault 1; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ echo "create MBR partition" parted --script /dev/sda -- mklabel msdos echo "create root partition" parted --script -a opt /dev/sda mkpart primary ext4 0% 100% echo "format partition" mkfs.ext4 -L nixos /dev/sda1 -F sleep 1 echo "mount target filesystem" mount /dev/disk/by-label/nixos /mnt echo "copy closure to nix store" nix copy --from file:///etc/system $(cat /etc/closure-nix-store-path.txt) --option binary-caches "" --no-check-sigs echo "install nix" nixos-install --no-root-passwd --option binary-caches "" --system $(cat /etc/closure-nix-store-path.txt) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ { config, pkgs, ... }: { imports = [ # https://nixos.wiki/wiki/Creating_a_NixOS_live_CD <nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix> <nixpkgs/nixos/modules/installer/cd-dvd/channel.nix> ]; # add the automated installation files environment.etc = { "install.sh" = { source = ./install.sh; mode = "0700"; }; "configuration.nix" = { source = ./configuration.nix; }; "hardware-configuration.nix" = { source = ./hardware-configuration.nix; }; "closure-nix-store-path.txt" = { source = ./closure-nix-store-path.txt; }; "system" = { source = ./system; }; }; # automatically run install script environment.etc."profile.local".text = '' /etc/install.sh reboot ''; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ # http://www.haskellforall.com/2018/08/nixos-in-production.html let nixpkgs = builtins.fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/b74b1cdb2fecc31ff7a127c5bc89771f887c93bb.tar.gz"; sha256 = "0ncr4g29220amqm4riaa1xf4jz55v2nmh9fi16f1gzhww1gplk8h"; }; in import "${nixpkgs}/nixos" { configuration = { imports = [ ./configuration.nix ]; }; system = "x86_64-linux"; }