From 239c2c9c44c6194297b94de87e24c6b058a79ff0 Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Sat, 3 Nov 2018 11:03:03 +0100 Subject: [PATCH] nix config udpate; polish top-level Justfile --- .gitignore | 1 + Justfile | 53 +++++++++++++++---- .../configuration/fullblown-workstation.nix | 7 +-- .../configuration/steveej-qtile-desktop.nix | 2 + .../devices/steveej-laptop/configuration.nix | 5 ++ nix/os/devices/steveej-laptop/system.nix | 15 +++--- nix/os/profiles/common/pkg.nix | 19 ++++++- nix/os/profiles/removable-medium/pkg.nix | 16 ------ 8 files changed, 81 insertions(+), 37 deletions(-) diff --git a/.gitignore b/.gitignore index 8288ed7..fe9ad7f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.swp *.qcow2 +.*.log diff --git a/Justfile b/Justfile index 24094b4..0f2f8f8 100755 --- a/Justfile +++ b/Justfile @@ -1,16 +1,49 @@ -devices action dir +moreargs="": +_device action dir +moreargs="": #!/usr/bin/env bash - set -x + set -e sudo $(nix-build --no-link --show-trace $(dirname {{dir}})/default.nix -A {{action}} --argstr dir {{dir}} {{moreargs}} ) -diskMount dir: - just -v devices diskMount {{dir}} -diskUmount dir: - just -v devices diskUmount {{dir}} +_rebuild-device dir rebuildarg="dry-activate": + just -v _device rebuild {{dir}} --argstr rebuildarg {{rebuildarg}} -diskInstall dir: - just -v devices diskInstall {{dir}} +# Rebulid this device's NixOS +rebuild-this-device rebuildarg="dry-activate": + just -v _rebuild-device nix/os/devices/$(hostname -s) {{rebuildarg}} -device-rebuild dir rebuildarg="build": - just -v devices rebuild {{dir}} --argstr rebuildarg {{rebuildarg}} +# Update nix-channels and switch to updated NixOS and home environments +update-this-device: + #!/usr/bin/env bash + echo Updating system channels... + sudo nix-channel --update > .$(hostname -s)_sysupdate.log 2>&1 + echo Updating system... + if just -v rebuild-this-device >> .$(hostname -s)_sysupdate.log 2>&1 ; then + echo System update successful + else + System update failed + fi + + if type home-manager > /dev/null 2>&1; then + echo Updating home... + if home-manager -v switch > .$(hostname -s)_homeupdate.log 2>&1 ; then + echo Home update successful + else + echo Home update failed + fi + fi + +# Sorry, this is a manual step for now. Please see nix/os/modules/encryptedDisk.nix for the layout +disk-prepare: + echo NOT IMPLEMENTED + +# Mount the target disk specified by device configuration directory. The 'dir' argument points to a device configuration, e.g. 'nix/os/devices/steveej-live-mmc-SL32G_0x259093f6' +disk-mount dir: + just -v _device diskMount {{dir}} + +# Unmount target disk, specified by device configuration directory +disk-umount dir: + just -v _device diskUmount {{dir}} + +# Perform an offline installation on the mounted the target disk, specified by device configuration directory +disk-install dir: + just -v _device diskInstall {{dir}} diff --git a/nix/home-manager/configuration/fullblown-workstation.nix b/nix/home-manager/configuration/fullblown-workstation.nix index 6cc45d6..6deb633 100644 --- a/nix/home-manager/configuration/fullblown-workstation.nix +++ b/nix/home-manager/configuration/fullblown-workstation.nix @@ -69,6 +69,10 @@ in { }; home.sessionVariables = { + # TODO: find a way to prevent using a store path for the current file + # HM_CONFIG_PATH=builtins.toString "${./.}"; + HM_CONFIG="fullblown-workstation"; + GOPATH="$HOME/src/go"; PATH=pkgs.lib.concatStringsSep ":" [ @@ -99,10 +103,7 @@ in { # Version Control Systems git-crypt unstablepkgs.pijul - gitFull gitless - mr - gitRepo # Cloud/Remote System Management diff --git a/nix/home-manager/configuration/steveej-qtile-desktop.nix b/nix/home-manager/configuration/steveej-qtile-desktop.nix index eef2f4f..8b91980 100644 --- a/nix/home-manager/configuration/steveej-qtile-desktop.nix +++ b/nix/home-manager/configuration/steveej-qtile-desktop.nix @@ -56,6 +56,8 @@ in { }; home.sessionVariables = { + HM_CONFIG=builtins.toString ./.; + GOPATH="$HOME/src/go"; PATH=pkgs.lib.concatStringsSep ":" [ diff --git a/nix/os/devices/steveej-laptop/configuration.nix b/nix/os/devices/steveej-laptop/configuration.nix index da100b3..c0d100e 100644 --- a/nix/os/devices/steveej-laptop/configuration.nix +++ b/nix/os/devices/steveej-laptop/configuration.nix @@ -1,6 +1,11 @@ { ... }: { + nixpkgs.config = { + allowBroken = false; + allowUnfree = true; + }; + imports = [ ../../profiles/common/configuration.nix ../../profiles/graphical/configuration.nix diff --git a/nix/os/devices/steveej-laptop/system.nix b/nix/os/devices/steveej-laptop/system.nix index 6935be2..1f55f91 100644 --- a/nix/os/devices/steveej-laptop/system.nix +++ b/nix/os/devices/steveej-laptop/system.nix @@ -5,9 +5,9 @@ }: let - unstablepkgs = import {}; + unstablepkgs = import { config = config.nixpkgs; }; -in rec { +in { # The NixOS release to be compatible with for stateful data such as databases. # system.stateVersion = "unstable"; @@ -19,6 +19,7 @@ in rec { server=/tectonic-ci.de/192.168.124.1 server=/tectonic-ci.lan/192.168.124.1 ''; + networking.firewall.enable = lib.mkForce false; networking.firewall.checkReversePath = false; networking.bridges."virbr1".interfaces = []; @@ -28,11 +29,11 @@ in rec { services.printing = { enable = true; - drivers = [ - pkgs.hplip - unstablepkgs.cups-kyodialog3 - unstablepkgs.mfcj6510dwlpr - unstablepkgs.mfcj6510dw-cupswrapper + drivers = with pkgs; [ + hplip + cups-kyodialog3 + mfcj6510dwlpr + mfcj6510dw-cupswrapper ]; }; diff --git a/nix/os/profiles/common/pkg.nix b/nix/os/profiles/common/pkg.nix index b29250a..eef45ef 100644 --- a/nix/os/profiles/common/pkg.nix +++ b/nix/os/profiles/common/pkg.nix @@ -2,6 +2,22 @@ { # Package configuration + nixpkgs.config = { + allowBroken = false; + allowUnfree = true; + + packageOverrides = pkgs: with pkgs; { + busyboxStatic = busybox.override { + enableStatic = true; + extraConfig = '' + CONFIG_STATIC y + CONFIG_INSTALL_APPLET_DONT y + CONFIG_INSTALL_APPLET_SYMLINKS n + ''; + }; + }; + }; + environment.systemPackages = with pkgs; [ elfutils exfat @@ -16,9 +32,10 @@ wget curl - git + gitFull pastebinit gist + mr usbutils pciutils diff --git a/nix/os/profiles/removable-medium/pkg.nix b/nix/os/profiles/removable-medium/pkg.nix index ae8f8e9..33ebb38 100644 --- a/nix/os/profiles/removable-medium/pkg.nix +++ b/nix/os/profiles/removable-medium/pkg.nix @@ -7,21 +7,5 @@ "${builtins.fetchGit { url = "https://github.com/rycee/home-manager.git"; ref = "master"; }}/nixos" ]; - nixpkgs.config = { - allowBroken = false; - allowUnfree = true; - - packageOverrides = pkgs: with pkgs; { - busyboxStatic = busybox.override { - enableStatic = true; - extraConfig = '' - CONFIG_STATIC y - CONFIG_INSTALL_APPLET_DONT y - CONFIG_INSTALL_APPLET_SYMLINKS n - ''; - }; - }; - }; - home-manager.users.steveej = import ../../../home-manager/configuration/removable-desktop.nix; }