Change flake.nix to allow different nixpkgs versions

This commit is contained in:
2024-06-14 20:32:52 -05:00
parent 0a8ded6db3
commit c8ccbac32c
10 changed files with 211 additions and 42 deletions

61
flake.lock generated
View File

@@ -30,18 +30,39 @@
"type": "github" "type": "github"
} }
}, },
"home-manager": { "home-manager-stable": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs-stable"
] ]
}, },
"locked": { "locked": {
"lastModified": 1717525419, "lastModified": 1717527182,
"narHash": "sha256-5z2422pzWnPXHgq2ms8lcCfttM0dz+hg+x1pCcNkAws=", "narHash": "sha256-vWSkg6AMok1UUQiSYVdGMOXKD2cDFnajITiSi0Zjd1A=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "a7117efb3725e6197dd95424136f79147aa35e5b", "rev": "845a5c4c073f74105022533907703441e0464bc3",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-24.05",
"repo": "home-manager",
"type": "github"
}
},
"home-manager-unstable": {
"inputs": {
"nixpkgs": [
"nixpkgs-unstable"
]
},
"locked": {
"lastModified": 1718243258,
"narHash": "sha256-abBpj2VU8p6qlRzTU8o22q68MmOaZ4v8zZ4UlYl5YRU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "8d5e27b4807d25308dfe369d5a923d87e7dbfda3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -50,13 +71,29 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1717602782, "lastModified": 1718208800,
"narHash": "sha256-pL9jeus5QpX5R+9rsp3hhZ+uplVHscNJh8n8VpqscM0=", "narHash": "sha256-US1tAChvPxT52RV8GksWZS415tTS7PV42KTc2PNDBmc=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e8057b67ebf307f01bdcc8fba94d94f75039d1f6", "rev": "cc54fb41d13736e92229c21627ea4f22199fee6b",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1718318537,
"narHash": "sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e9ee548d90ff586a6471b4ae80ae9cfcbceb3420",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -70,8 +107,10 @@
"inputs": { "inputs": {
"currentSystem": "currentSystem", "currentSystem": "currentSystem",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"home-manager": "home-manager", "home-manager-stable": "home-manager-stable",
"nixpkgs": "nixpkgs" "home-manager-unstable": "home-manager-unstable",
"nixpkgs-stable": "nixpkgs-stable",
"nixpkgs-unstable": "nixpkgs-unstable"
} }
}, },
"systems": { "systems": {

View File

@@ -4,15 +4,28 @@
inputs = { inputs = {
currentSystem.url = "path:/etc/nixos/hostname"; currentSystem.url = "path:/etc/nixos/hostname";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
home-manager.url = "github:nix-community/home-manager"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
home-manager-stable.url = "github:nix-community/home-manager/release-24.05";
home-manager-stable.inputs.nixpkgs.follows = "nixpkgs-stable";
home-manager-unstable.url = "github:nix-community/home-manager";
home-manager-unstable.inputs.nixpkgs.follows = "nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = inputs@{ self, currentSystem, nixpkgs, home-manager, flake-utils, ... }: let outputs = inputs@{ self
, currentSystem
, nixpkgs-stable
, nixpkgs-unstable
, home-manager-stable
, home-manager-unstable
, flake-utils
, ...
}: let
inherit (self) outputs; inherit (self) outputs;
inherit (currentSystem) hostname; inherit (currentSystem) hostname;
@@ -21,6 +34,7 @@
configs."ankaa" = { configs."ankaa" = {
system = "x86_64-linux"; system = "x86_64-linux";
common.nixpkgs = "unstable";
openssh = { openssh = {
enable = true; enable = true;
@@ -95,6 +109,7 @@
configs."alpheratz" = { configs."alpheratz" = {
system = "x86_64-linux"; system = "x86_64-linux";
common.nixpkgs = "unstable";
audio = { audio = {
pipewire.enable = true; pipewire.enable = true;
@@ -127,16 +142,36 @@
}; };
}; };
currentConfig = configs."${hostname}";
system = currentConfig.system;
configs."default-hostname" = {}; nixpkgs = if currentConfig.common.nixpkgs == "unstable" then
nixpkgs-unstable
else
nixpkgs-stable;
home-manager = if currentConfig.common.nixpkgs == "unstable" then
home-manager-unstable
else
home-manager-stable;
system = configs."${hostname}".system;
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = with overlays; [ gamescope ]; overlays = with overlays; [ gamescope ];
config.allowUnfree = true; config.allowUnfree = true;
}; };
systemConfig = if builtins.pathExists (./. + "/hosts/${hostname}/system.nix") then
(./. + "/hosts/${hostname}/system.nix")
else
./hosts/default/system.nix;
homeConfig = if builtins.pathExists (./. + "/hosts/${hostname}/home.nix") then
(./. + "/hosts/${hostname}/home.nix")
else
./hosts/default/home.nix;
in { in {
nixosConfigurations = { nixosConfigurations = {
"${hostname}" = nixpkgs.lib.nixosSystem { "${hostname}" = nixpkgs.lib.nixosSystem {
@@ -147,10 +182,10 @@
modules = [ modules = [
{ {
networking.hostName = hostname; networking.hostName = hostname;
simmer = configs."${hostname}"; simmer = currentConfig;
} }
(import ./modules/nix) (import ./modules/nix)
(./. + "/hosts/${hostname}/system.nix") systemConfig
(./. + "/hosts/${hostname}/hardware-configuration.nix") (./. + "/hosts/${hostname}/hardware-configuration.nix")
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
@@ -161,7 +196,7 @@
systemConfig = configs."${hostname}"; systemConfig = configs."${hostname}";
}; };
home-manager.users.eesim = import (./. + "/hosts/${hostname}/home.nix"); home-manager.users.eesim = import homeConfig;
} }
]; ];
}; };

View File

@@ -65,7 +65,6 @@
users.users.eesim = { users.users.eesim = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" "video" "audo" "networkmanager" ]; extraGroups = [ "wheel" "video" "audo" "networkmanager" ];
packages = with pkgs; [];
shell = pkgs.fish; shell = pkgs.fish;
}; };

View File

@@ -0,0 +1,45 @@
# 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 = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/ad45b094-608d-4850-b5ba-0f3917947629";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/ad45b094-608d-4850-b5ba-0f3917947629";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/ad45b094-608d-4850-b5ba-0f3917947629";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
swapDevices = [ ];
# 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.wlp0s20f3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

23
hosts/default/home.nix Normal file
View File

@@ -0,0 +1,23 @@
{
config,
pkgs,
...
}:
{
imports = [
../../modules/home
];
home = {
username = "eesim";
homeDirectory = "/home/eesim";
};
home.file.".config/nvim".source = ../shared/dotfiles/nvim;
home.file.".tmux.conf".source = ../shared/dotfiles/tmux;
programs.home-manager.enable = true;
home.stateVersion = "23.11";
}

39
hosts/default/system.nix Normal file
View File

@@ -0,0 +1,39 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{
lib,
config,
pkgs,
...
}: {
nix = {
settings = {
experimental-features = "nix-command flakes";
};
};
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Set your time zone.
time.timeZone = "America/Chicago";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
# Define a user account.
users.users.eesim = {
isNormalUser = true;
extraGroups = [ "wheel" ];
};
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment?
}

View File

@@ -1,11 +0,0 @@
[1717810556] Log start
[1717810556] Cmd: llama
[1717810556] main: build = 0 (unknown)
[1717810556] main: built with gcc (GCC) 13.2.0 for x86_64-unknown-linux-gnu
[1717810556] main: seed = 1717810556
[1717810556] main: llama backend init
[1717810556] main: load the model and apply lora adapter, if any
[1717810556] llama_model_load: error loading model: llama_model_loader: failed to load model from models/7B/ggml-model-f16.gguf
[1717810556] llama_load_model_from_file: failed to load model
[1717810556] main: error: unable to load model

View File

@@ -34,6 +34,11 @@ in
type = types.enum [ "ctrl-esc" "esc" "caps" ]; type = types.enum [ "ctrl-esc" "esc" "caps" ];
default = "ctrl-esc"; default = "ctrl-esc";
}; };
nixpkgs = mkOption {
description = "Which nixpkgs version to use";
type = types.any;
};
}; };

View File

@@ -58,6 +58,7 @@ in
config = { config = {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
ldns ldns
mtr
] ]
++ optional cfg.wireguard.enable wireguard-tools; ++ optional cfg.wireguard.enable wireguard-tools;

View File

@@ -1,6 +0,0 @@
{}:
{
final: prev: {
llama-cpp = ;
}
}