These files are my personal nixos setup, bringing in spacemacs and having my home directory setup with home-manager (as a nixos module).
It gives me the ability to have the same setup on my work and home nixos modulo a few machine specific bits like video drivers. The machineName parameter in default.nix and the machine.$machineName.nix files take care of these bits.
It is very unlikely that you want this repo precisely unless you are me, but feel free to browse and steal bits if you'd like! :)
Reach out to me via a github issue or on IRC freenode.net#qfpl if you need any help. There are also #nixos and #home-manager channels on that network too. If you don't have an IRC client installed, you can access freenode via a webpage here: http://webchat.freenode.net/
How this works on my machine is that I have a /etc/nixos that looks like:
bkolera at bkolera-qfpl in ~
$ cat /etc/nixos/configuration.nix
let thunk = builtins.fromJSON (builtins.readFile /etc/nixos/thunk.json);
in (import (builtins.fetchGit {
inherit (thunk) url rev;
})) "qfpl"
# This is put there when I run ./update.sh
bkolera at bkolera-qfpl in ~
$ cat /etc/nixos/thunk.json
{
"url": "https://github.com/benkolera/nix",
"rev": "6588a92446d6c55f16eb7d8b957e4172e86568ef",
"date": "2019-05-27T15:58:40+10:00",
"sha256": "1rck47bmfrn8sgf5wgjq264s16sa1q232a6shv9b64if04mzhf61",
"fetchSubmodules": false
}
# This is setup by the nixos installer for my physical machine. You don't want this exact file! :)
bkolera at bkolera-qfpl in ~
$ cat /etc/nixos/hardware-configuration.nix
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/139e1c16-8be6-49d2-b80d-a16abf908ad9";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/CB6B-957B";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/e02e41a3-40e6-4787-9bd3-e3800d0aeecb"; }
];
nix.maxJobs = lib.mkDefault 8;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}
With this setup, a nixos-rebuild switch fully manages my home directory and global nixos from the git revision described in thunk.json. To update the config to a latest revision, I can run update.sh from this directory to make a new thunk.json.
You may decide to just git checkout to /etc/nixos instead of my fetchgit setup. There are folklore reasons that importing nix code from a derivation (IFD; which is what we are doing here in the configuration.nix.example) is a bad idea because it can cause nix bugs, but this seems to work for me. I like this way because I can't forget to commit my changes this way as it doesn't get deployed if it is not in git. :)
The nixos module crams the actual activation (the thing that mutates your home directory to symlink to the built configs) into a systemd one shot, so you've got to go digging when things go wrong. Do a journalctl -u home-manager-bkolera
to get logs if you get a systemd error from the home-manager-bkolera service on nixos switch.
This forces you to use nixos-unstable as it currently stands because home-manager is tracking master. It also forces you to keep your nixos channel version consistent across all your machines, since everything is sharing the same nixos config and home manager version + config. If you update your nixos to be really new and forget to update home manager, things could break. Or if you update home manager and forget to update your nixos channel, thing could also break. Be careful with this. I tend to stay on the bleeding edge of nixos unstable on all my machines (updating weekly), so this is not an issue for me unless I'm dodging a bug.
Smokeping can't get reinstalled because it writes the fast cgi script as non writable and then tries to write to it again. A sudo chmod 755 /var/lib/smokeping/smokeping.fcgi
is an OK bandaid.