I’m just now trying to dive into Flakes. I have a system installed using
HOSTNAME='myhost'
nixos-install -v --show-trace --no-root-passwd --root /mnt --flake /mnt/etc/nixos#${HOSTNAME} --impure
Everything seems to install fine. However, when I reboot into the machine, no packages are installed. Nothing else from the flake.nix seems to be taking effect. No log in screen. Not even vim is installed.
Here’s the flake file
{
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-22.05;
inputs.home-manager.url = github:nix-community/home-manager;
outputs = { self, nixpkgs, ... }@attrs: {
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
# force git commit before running
# https://www.tweag.io/blog/2020-07-31-nixos-flakes/
system.configurationRevision =
if self ? rev
then self.rev
else throw "Refusing to build from a dirty Git tree!";
specialArgs = attrs;
# pin all packages to this flake's nixpkgs
# https://www.tweag.io/blog/2020-07-31-nixos-flakes/
nix.registry.nixpkgs.flake = nixpkgs;
modules = [
./configuration.nix
[ ({ pkgs, ... }: {
#----------------------------------------
# Network configuration.
#----------------------------------------
# Set your time zone.
time.timeZone = "America/Los_Angeles";
networking.useDHCP = false;
networking.firewall.allowedTCPPorts = [
22
];
networking.networkmanager.enable = true;
#----------------------------------------
# Enable the X11 windowing system.
#----------------------------------------
services.xserver.enable = true;
#----------------------------------------
# Enable the Plasma 5 Desktop Environment.
#----------------------------------------
services.xserver.displayManager.sddm.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
# sound
hardware.pulseaudio.enable = true;
hardware.pulseaudio.support32Bit = true; ## If compatibility with 32-bit applications is desired.
# -----------------
# install packages
# -----------------
nixpkgs.config.allowUnfree = true;
hardware.bluetooth.enable = true;
services.blueman.enable = true;
environment.systemPackages = with pkgs; [
#-----------------
# cli
#-----------------
#vim
vimHugeX # includes vim, gvim etc.
emacs
htop
tmux
rsync
];
#----------------------------------------
# ssh
#----------------------------------------
services.openssh.enable = true;
services.fail2ban = {
enable = true;
maxretry = 5;
ignoreIP = [
"127.0.0.0/8"
];
};
})
];
];
};
};
}