working flakes

This commit is contained in:
John Lancaster
2024-12-07 19:16:26 +00:00
parent 92324773ff
commit a6348adef1
5 changed files with 223 additions and 14 deletions

View File

@@ -8,12 +8,11 @@ in
system.stateVersion = stateVersion; system.stateVersion = stateVersion;
imports = [ imports = [
(modulesPath + "/virtualisation/proxmox-lxc.nix") (modulesPath + "/virtualisation/proxmox-lxc.nix")
(import "${builtins.fetchTarball https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz}/nixos")
(fetchTarball "https://github.com/nix-community/nixos-vscode-server/tarball/master")
(import ./loki.nix { inherit pkgs; inherit userName; })
]; ];
time.timeZone = "America/Chicago"; # time.timeZone = "America/Chicago";
nix.settings.experimental-features = [ "nix-command" "flakes" ];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
(pkgs.writeShellScriptBin "nrbs" "sudo nixos-rebuild switch") (pkgs.writeShellScriptBin "nrbs" "sudo nixos-rebuild switch")
@@ -30,20 +29,10 @@ in
# Networking stuff # Networking stuff
services.avahi = { enable = true; nssmdns4 = true; }; services.avahi = { enable = true; nssmdns4 = true; };
services.vscode-server.enable = true;
# Uses rust-based sudo # Uses rust-based sudo
security.sudo-rs = { security.sudo-rs = {
enable = true; enable = true;
execWheelOnly = false; execWheelOnly = false;
wheelNeedsPassword = false; # allows sudo without password for those in the wheel group wheelNeedsPassword = false; # allows sudo without password for those in the wheel group
}; };
home-manager = {
useGlobalPkgs = true;
users.root = {
home.stateVersion = stateVersion;
imports = [ (import ./git.nix { inherit repoPath; }) ];
};
};
} }

130
flake.lock generated Normal file
View File

@@ -0,0 +1,130 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1733484277,
"narHash": "sha256-i5ay20XsvpW91N4URET/nOc0VQWOAd4c4vbqYtcH8Rc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "d00c6f6d0ad16d598bf7e2956f52c1d9d5de3c3a",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1733392399,
"narHash": "sha256-kEsTJTUQfQFIJOcLYFt/RvNxIK653ZkTBIs4DG+cBns=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d0797a04b81caeae77bcff10a9dde78bc17f5661",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1733412085,
"narHash": "sha256-FillH0qdWDt/nlO6ED7h4cmN+G9uXwGjwmCnHs0QVYM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4dc2fc4e62dbf62b84132fe526356fbac7b03541",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-24.11",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1682134069,
"narHash": "sha256-TnI/ZXSmRxQDt2sjRYK/8j8iha4B4zP2cnQCZZ3vp7k=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "fd901ef4bf93499374c5af385b2943f5801c0833",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable",
"vscode-server": "vscode-server"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"vscode-server": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1729422940,
"narHash": "sha256-DlvJv33ml5UTKgu4b0HauOfFIoDx6QXtbqUF3vWeRCY=",
"owner": "nix-community",
"repo": "nixos-vscode-server",
"rev": "8b6db451de46ecf9b4ab3d01ef76e59957ff549f",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-vscode-server",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

67
flake.nix Normal file
View File

@@ -0,0 +1,67 @@
{
description = "Loki flake config";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nixpkgs-stable.url = "nixpkgs/nixos-24.11";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
vscode-server.url = "github:nix-community/nixos-vscode-server";
};
outputs = {
self,
nixpkgs,
nixpkgs-stable,
home-manager,
vscode-server,
...
} @ inputs:
let
inherit (self) outputs;
system = "x86_64-linux";
timeZone = "America/Chicago";
hostname = "loki";
lokiUser = "loki";
lokiPath = "/srv/loki";
in
{
nixosConfigurations = {
# FIXME replace with your hostname
${hostname} = nixpkgs.lib.nixosSystem {
system = "${system}";
# time.timeZone = "${timeZone}";
specialArgs = {inherit inputs outputs;};
modules = [
./configuration.nix # > Our main nixos configuration file <
vscode-server.nixosModules.default
({ config, pkgs, ... }: {services.vscode-server.enable = true;})
];
};
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = {
useGlobalPkgs = true;
"root@${hostname}" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
extraSpecialArgs = {inherit inputs outputs;};
modules = [(import ./git.nix { repoPath = "${lokiPath}"; })];
};
# FIXME replace with your username@hostname
"${lokiUser}@${hostname}" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
extraSpecialArgs = {inherit inputs outputs;};
# > Our main home-manager configuration file <
modules = [
(import ./home.nix { user = "${lokiUser}"; repoPath = "${lokiPath}"; })
(import ./git.nix { repoPath = "${lokiPath}"; })
];
};
};
};
}

9
home.nix Normal file
View File

@@ -0,0 +1,9 @@
{ user, repoPath, ... }:
{
programs.home-manager.enable = true;
home = {
stateVersion = "24.05";
username = "${user}";
homeDirectory = "${repoPath}";
};
}

14
vscode.nix Normal file
View File

@@ -0,0 +1,14 @@
{
inputs.vscode-server.url = "github:nix-community/nixos-vscode-server";
outputs = { self, nixpkgs, vscode-server }: {
nixosConfigurations.yourhostname = nixpkgs.lib.nixosSystem {
modules = [
vscode-server.nixosModules.default
({ config, pkgs, ... }: {
services.vscode-server.enable = true;
})
];
};
};
}