nix: switching to using flakes

This commit is contained in:
Julian Mutter 2023-03-17 11:07:39 +01:00
parent 7b9b3b2b07
commit 18b670ceec
5 changed files with 118 additions and 4 deletions

View File

@ -58,3 +58,4 @@ xmonad = "~/.xmonad"
[nix.files]
"direnvrc" = "~/.config/direnv/direnvrc"
"nix/configuration.nix" = "/etc/nixos/configuration.nix"
"nix/flake.nix" = "/etc/nixos/flake.nix"

View File

@ -6,7 +6,7 @@
{
imports = [ # Include the results of the hardware scan.
/etc/nixos/hardware-configuration.nix
./hardware-configuration.nix
];
# Bootloader.
@ -139,9 +139,9 @@
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
nixpkgs.config.packageOverrides = pkgs: {
unstable = import <nixos-unstable> { config = config.nixpkgs.config; };
};
# nixpkgs.config.packageOverrides = pkgs: {
# unstable = import <nixos-unstable> { config = config.nixpkgs.config; };
# };
environment.etc."manual-links/xfce4-notifyd".source =
"${pkgs.xfce.xfce4-notifyd}/lib/xfce4/notifyd/xfce4-notifyd";

42
nix/flake.lock generated Normal file
View File

@ -0,0 +1,42 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1678872516,
"narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-22.11",
"type": "indirect"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1678898370,
"narHash": "sha256-xTICr1j+uat5hk9FyuPOFGxpWHdJRibwZC+ATi0RbtE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ac718d02867a84b42522a0ece52d841188208f2c",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable"
}
}
},
"root": "root",
"version": 7
}

29
nix/flake.nix Normal file
View File

@ -0,0 +1,29 @@
{
inputs.nixpkgs.url = "nixpkgs/nixos-22.11";
inputs.nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
# inputs.home-manager.url = "github:nix-community/home-manager";
outputs = { self, nixpkgs, nixpkgs-unstable, ... }@attrs:
let
system = "x86_64-linux";
overlay-unstable = final: prev: {
unstable = nixpkgs-unstable.legacyPackages.${prev.system};
# use this variant if unfree packages are needed:
# unstable = import nixpkgs-unstable {
# inherit system;
# config.allowUnfree = true;
# };
};
in {
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = attrs;
modules = [
# Overlays-module makes "pkgs.unstable" available in configuration.nix
({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; })
./configuration.nix
];
};
};
}

View File

@ -0,0 +1,42 @@
# 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, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "xhci_pci" "usbhid" "usb_storage" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/7469546c-44d6-44a7-aecd-28aae51c84ca";
fsType = "ext4";
};
fileSystems."/boot/efi" =
{ device = "/dev/disk/by-uuid/5A58-A8EB";
fsType = "vfat";
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/232d00ae-a844-4b59-97e9-d7248ff179a4";
fsType = "btrfs";
};
swapDevices = [ { device = "/swapfile"; } ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}