Compare commits

..

9 Commits

Author SHA1 Message Date
John Lancaster
41bf8a074e simplified 2024-12-08 12:21:58 -06:00
John Lancaster
68bfa4ef4b added nfs script 2024-12-08 12:13:34 -06:00
John Lancaster
3121bffc30 rename 2024-12-07 14:50:05 -06:00
John Lancaster
a3179e52d7 more reorg 2024-12-07 14:49:14 -06:00
John Lancaster
679f8bfca0 reorg 2024-12-07 14:41:23 -06:00
John Lancaster
f303b9ec57 better variables 2024-12-07 14:26:10 -06:00
John Lancaster
dd3de3c145 actually added loki back to it 2024-12-07 14:13:34 -06:00
John Lancaster
d741b62d2c working variables 2024-12-07 13:47:50 -06:00
John Lancaster
4e87f3119f WIP flakes 2024-12-07 19:33:13 +00:00
7 changed files with 68 additions and 39 deletions

40
flake.lock generated
View File

@@ -48,9 +48,10 @@
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "owner": "NixOS",
"ref": "nixos-unstable", "ref": "nixos-unstable",
"type": "indirect" "repo": "nixpkgs",
"type": "github"
} }
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
@@ -63,12 +64,25 @@
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "owner": "NixOS",
"ref": "nixos-24.11", "ref": "nixos-24.11",
"type": "indirect" "repo": "nixpkgs",
"type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": {
"lastModified": 0,
"narHash": "sha256-kEsTJTUQfQFIJOcLYFt/RvNxIK653ZkTBIs4DG+cBns=",
"path": "/nix/store/nr5nl3zwzl02x3rnikjbry3s5xy7bm1d-source",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1682134069, "lastModified": 1682134069,
"narHash": "sha256-TnI/ZXSmRxQDt2sjRYK/8j8iha4B4zP2cnQCZZ3vp7k=", "narHash": "sha256-TnI/ZXSmRxQDt2sjRYK/8j8iha4B4zP2cnQCZZ3vp7k=",
@@ -106,9 +120,25 @@
} }
}, },
"vscode-server": { "vscode-server": {
"inputs": {
"nixpkgs": "nixpkgs_2",
"vscode-server": "vscode-server_2"
},
"locked": {
"lastModified": 1,
"narHash": "sha256-IWEQNW6HVBCztzSy/1SmMTU6R/dyLlnZrJKk9ldJG/I=",
"path": "./nixos/vscode",
"type": "path"
},
"original": {
"path": "./nixos/vscode",
"type": "path"
}
},
"vscode-server_2": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1729422940, "lastModified": 1729422940,

View File

@@ -2,13 +2,13 @@
description = "Loki flake config"; description = "Loki flake config";
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "nixpkgs/nixos-24.11"; nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
vscode-server.url = "github:nix-community/nixos-vscode-server"; vscode-server.url = "path:./nixos/vscode";
}; };
outputs = { outputs = {
@@ -16,28 +16,42 @@
nixpkgs, nixpkgs,
nixpkgs-stable, nixpkgs-stable,
home-manager, home-manager,
vscode-server,
... ...
} @ inputs: } @ inputs:
let let
inherit (self) outputs; inherit (self) outputs;
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
stateVersion = "24.05";
timeZone = "America/Chicago"; timeZone = "America/Chicago";
hostname = "loki"; hostname = "loki";
lokiPort = 3100;
lokiUser = "loki"; lokiUser = "loki";
lokiPath = "/srv/loki"; lokiPath = "/srv/loki";
in in
{ {
nixosConfigurations = { nixosConfigurations = {
# FIXME replace with your hostname
${hostname} = nixpkgs.lib.nixosSystem { ${hostname} = nixpkgs.lib.nixosSystem {
system = "${system}";
# time.timeZone = "${timeZone}";
specialArgs = {inherit inputs outputs;}; specialArgs = {inherit inputs outputs;};
modules = [ modules = [
./configuration.nix # > Our main nixos configuration file < ./nixos/configuration.nix # > Our main nixos configuration file <
vscode-server.nixosModules.default "${nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
({ config, pkgs, ... }: {services.vscode-server.enable = true;}) ({ ... }: {
nixpkgs.hostPlatform = "${system}";
system.stateVersion = "${stateVersion}";
time.timeZone = "${timeZone}";
environment.systemPackages = [
(pkgs.writeShellScriptBin "nfs" ''
sudo nixos-rebuild switch --flake git+file://${lokiPath}#${hostname}
'')
];
})
(import ./nixos/loki.nix {
inherit pkgs;
inherit lokiPort;
inherit lokiUser;
inherit lokiPath;
})
]; ];
}; };
}; };
@@ -49,7 +63,7 @@
"root@${hostname}" = home-manager.lib.homeManagerConfiguration { "root@${hostname}" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
extraSpecialArgs = {inherit inputs outputs;}; extraSpecialArgs = {inherit inputs outputs;};
modules = [(import ./git.nix { repoPath = "${lokiPath}"; })]; modules = [(import ./home-manager/git.nix { repoPath = "${lokiPath}"; })];
}; };
# FIXME replace with your username@hostname # FIXME replace with your username@hostname
@@ -58,8 +72,8 @@
extraSpecialArgs = {inherit inputs outputs;}; extraSpecialArgs = {inherit inputs outputs;};
# > Our main home-manager configuration file < # > Our main home-manager configuration file <
modules = [ modules = [
(import ./home.nix { user = "${lokiUser}"; repoPath = "${lokiPath}"; }) (import ./home-manager/home.nix { user = "${lokiUser}"; repoPath = "${lokiPath}"; })
(import ./git.nix { repoPath = "${lokiPath}"; }) (import ./home-manager/git.nix { repoPath = "${lokiPath}"; })
]; ];
}; };
}; };

View File

@@ -1,17 +1,5 @@
{ pkgs, lib, modulesPath, ... }: { pkgs, ... }:
let
stateVersion = "24.05";
userName = "loki";
repoPath = "/srv/loki";
in
{ {
system.stateVersion = stateVersion;
imports = [
(modulesPath + "/virtualisation/proxmox-lxc.nix")
];
# time.timeZone = "America/Chicago";
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [

View File

@@ -1,18 +1,15 @@
{ pkgs, userName, ... }: { pkgs, lokiPort ? 3100, ... }:
let
lokiPort = 3100;
in
{ {
networking.firewall.allowedTCPPorts = [ lokiPort ]; networking.firewall.allowedTCPPorts = [ lokiPort ];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
(pkgs.writeShellScriptBin "loki-check" "curl http://localhost:3100/ready") (pkgs.writeShellScriptBin "loki-check" "curl http://localhost:${builtins.toString lokiPort}/ready")
(pkgs.writeShellScriptBin "loki-logs" "journalctl -b -u loki.service -n 25") (pkgs.writeShellScriptBin "loki-logs" "journalctl -b -u loki.service -n 10")
]; ];
services.loki = { services.loki = {
enable = true; enable = true;
user = "${userName}"; user = "loki";
configuration = { configuration = {
server.http_listen_port = lokiPort; server.http_listen_port = lokiPort;