Skip to content

Instantly share code, notes, and snippets.

@Himura2la
Last active June 30, 2025 18:55
Show Gist options
  • Save Himura2la/9b1bbe794d05e6f4cb804f7fdecd9f6f to your computer and use it in GitHub Desktop.
Save Himura2la/9b1bbe794d05e6f4cb804f7fdecd9f6f to your computer and use it in GitHub Desktop.
Easy Flakes: transition to flakes with unstable channel and home-manager.

Upgrade

nix flake update  # minor
sudo nixos-rebuild switch --flake '.?submodules=1'

sudo nix-channel --add https://channels.nixos.org/nixos-25.05 nixos  # major (for nix-shell)

Clean

sudo nix-collect-garbage --delete-older-than 30d
nix-collect-garbage --delete-older-than 30d

Home Manager

{ config, pkgs, home-manager, ... }: {
  imports = [ home-manager.nixosModules.default ];
  # ...
}

Unstable

{ pkgs, ... }:
{
  users.users.himura.packages = with pkgs; [
    unstable.winbox4
    # ...
  ];
}
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
home-manager.url = "github:nix-community/home-manager/release-24.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs, nixpkgs-unstable, ... }@attrs:
let
system = "x86_64-linux";
overlay-unstable = final: prev: {
unstable = import nixpkgs-unstable {
inherit system;
config.allowUnfree = true;
};
};
in {
nixosConfigurations.himura-acer = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = attrs;
modules = [
({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; })
./configuration.nix
];
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment