Hello,
I am very happy running NixOS as my daily driver laptop system as well as on an old laptop as a home server.
However the requirements for these two environments are a little different. On my daily driver I like to have unstable NixOS while on the server I would like to have the latest NixOS stable.
Because I have the configuration in a single flake so far, I have been running unstable everywhere.
Here is an extract of my flake:
description = "Configuration for all my computing devices (I am missing the NixOS Phone still)";
inputs = {
# nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
# url = "github:nix-community/home-manager/release-23.11";
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs @ { self, nixpkgs, nixpkgs-stable, nixpkgs-unstable, home-manager, secrets, ... }:
let
vars = {
user = "marci";
location = "$HOME/nix";
editor = "hx";
};
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
stable = import nixpkgs-stable {
inherit system;
config.allowUnfree = true;
};
unstable = import nixpkgs-unstable {
inherit system;
config.allowUnfree = true;
# temporary allow old electron because of obsidian
# config.permittedInsecurePackages = [
# "electron-25.9.0"
# ];
};
lib = nixpkgs.lib;
in {
nixosConfigurations = {
yoga = lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs secrets system stable unstable vars;
host = {
hostName = "yoga";
};
};
modules = [
./hosts/yoga
./configuration.nix
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
];
};
inspirion = lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs secrets system stable unstable vars;
host = {
hostName = "inspirion";
};
};
modules = [
./hosts/inspirion
./server.nix
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
];
};
};
};
}
Is there a way to run stable on my server (inspirion) and unstable on my daily driver (yoga)? Or do I have to split my configuration up into two different flakes?