Skip to content

Instantly share code, notes, and snippets.

@kekonn
Created April 10, 2024 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kekonn/6e16e01af1a14b668f41aa56b87f156f to your computer and use it in GitHub Desktop.
Save kekonn/6e16e01af1a14b668f41aa56b87f156f to your computer and use it in GitHub Desktop.
Flake setup
{
description = "NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
vscode-server.url = "github:nix-community/nixos-vscode-server";
vscode-server.inputs.nixpkgs.follows = "nixpkgs";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ nixpkgs, home-manager, vscode-server, disko, sops-nix, ... }:
let
myConfig = with nixpkgs; {
zellijLoginShell = lib.options.mkEnableOption {
name = "zellijLoginShell";
description = "Enable Zellij as a login shell";
default = true;
};
enableAtuin = lib.options.mkEnableOption {
description = "Enable atuin for history";
name = "enableAtuin";
default = false;
};
extraProfile = lib.mkOption {
name = "extraProfile";
description = "Extra lines added to .profile";
type = lib.types.str;
default = "";
};
};
in {
nixosConfigurations = {
luna = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./general
./luna/configuration.nix
home-manager.nixosModules.home-manager
({pkgs, myConfig, ... }: {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.sharedModules = [
inputs.sops-nix.homeManagerModules.sops
];
home-manager.users.kekkon = import ./general/home.nix;
# Optionally, use home-manager.extraSpecialArgs to pass
# arguments to home.nix
home-manager.extraSpecialArgs = myConfig // {
extraProfile = ''
export NIXOS_CONFIG=/home/kekkon/nix-flakes/flake.nix
'';
};
})
vscode-server.nixosModules.default
({config, pkgs, myConfig, ...}: {
services.atuin.enable = myConfig.enableAtuin or false;
services.vscode-server.enable = true;
})
disko.nixosModules.disko
sops-nix.nixosModules.sops
({...}: {
nixpkgs.config.allowUnfree = true;
})
];
};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment