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"
},
"original": {
"id": "nixpkgs",
"owner": "NixOS",
"ref": "nixos-unstable",
"type": "indirect"
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
@@ -63,12 +64,25 @@
"type": "github"
},
"original": {
"id": "nixpkgs",
"owner": "NixOS",
"ref": "nixos-24.11",
"type": "indirect"
"repo": "nixpkgs",
"type": "github"
}
},
"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": {
"lastModified": 1682134069,
"narHash": "sha256-TnI/ZXSmRxQDt2sjRYK/8j8iha4B4zP2cnQCZZ3vp7k=",
@@ -106,9 +120,25 @@
}
},
"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": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1729422940,

View File

@@ -2,13 +2,13 @@
description = "Loki flake config";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nixpkgs-stable.url = "nixpkgs/nixos-24.11";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/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";
vscode-server.url = "path:./nixos/vscode";
};
outputs = {
@@ -16,28 +16,42 @@
nixpkgs,
nixpkgs-stable,
home-manager,
vscode-server,
...
} @ inputs:
let
inherit (self) outputs;
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
stateVersion = "24.05";
timeZone = "America/Chicago";
hostname = "loki";
lokiPort = 3100;
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;})
./nixos/configuration.nix # > Our main nixos configuration file <
"${nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
({ ... }: {
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 {
pkgs = nixpkgs.legacyPackages.${system};
extraSpecialArgs = {inherit inputs outputs;};
modules = [(import ./git.nix { repoPath = "${lokiPath}"; })];
modules = [(import ./home-manager/git.nix { repoPath = "${lokiPath}"; })];
};
# FIXME replace with your username@hostname
@@ -58,10 +72,10 @@
extraSpecialArgs = {inherit inputs outputs;};
# > Our main home-manager configuration file <
modules = [
(import ./home.nix { user = "${lokiUser}"; repoPath = "${lokiPath}"; })
(import ./git.nix { repoPath = "${lokiPath}"; })
(import ./home-manager/home.nix { user = "${lokiUser}"; repoPath = "${lokiPath}"; })
(import ./home-manager/git.nix { repoPath = "${lokiPath}"; })
];
};
};
};
}
}

View File

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

View File

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