Compare commits

..

37 Commits

Author SHA1 Message Date
John Lancaster
afe391ef8e WIP 2024-12-09 17:38:18 -06:00
John Lancaster
fdb9d8717d fake email 2024-12-08 16:49:40 -06:00
John Lancaster
857aedca79 WIP change args 2024-12-08 16:41:48 -06:00
John Lancaster
3edc60fe84 impure 2024-12-08 16:37:10 -06:00
John Lancaster
7a1a40c2ae variables again 2024-12-08 16:36:08 -06:00
John Lancaster
d22763540a single home module 2024-12-08 16:34:11 -06:00
John Lancaster
fd21e90e1d removed comment 2024-12-08 16:32:32 -06:00
John Lancaster
138df54fbc more 2024-12-08 16:22:59 -06:00
John Lancaster
30c43f5488 pruning 2024-12-08 16:05:07 -06:00
John Lancaster
343c6a89db continuous reorg 2024-12-08 16:03:45 -06:00
John Lancaster
9334d2cc7f trying to fix git 2024-12-08 15:25:55 -06:00
John Lancaster
9d4c47682b another fix 2024-12-08 14:09:04 -06:00
John Lancaster
e397231579 again 2024-12-08 14:03:52 -06:00
John Lancaster
add8fca4b0 vscode fix? 2024-12-08 14:03:07 -06:00
John Lancaster
b973c002e1 permissions 2024-12-08 13:56:00 -06:00
John Lancaster
6e891cc6da using nix path for authorized_keys file 2024-12-08 13:48:09 -06:00
John Lancaster
6dfa38cc5e added isNormalUser 2024-12-08 13:40:10 -06:00
John Lancaster
b16ab9e230 renamed 2024-12-08 13:37:48 -06:00
John Lancaster
fc2ef9344e clone script 2024-12-08 13:33:04 -06:00
John Lancaster
50bb31a670 authorized_keys 2024-12-08 13:30:58 -06:00
John Lancaster
5233efa8ba moved script 2024-12-08 13:24:09 -06:00
John Lancaster
ee521c87eb removed commented lines 2024-12-08 13:10:51 -06:00
John Lancaster
7667011dbf commented scripts out 2024-12-08 13:09:01 -06:00
John Lancaster
6bf90e6b24 reorg 2024-12-08 13:04:18 -06:00
John Lancaster
36cf352c67 removed variable 2024-12-08 12:47:28 -06:00
John Lancaster
2a00037711 another fix 2024-12-08 12:45:47 -06:00
John Lancaster
38c7effc93 fix 2024-12-08 12:45:27 -06:00
John Lancaster
fee9256b39 WIP 2024-12-08 12:45:06 -06:00
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
8 changed files with 137 additions and 93 deletions

View File

@@ -1,22 +1,10 @@
{ pkgs, lib, modulesPath, ... }: { pkgs, userSettings, systemSettings, ... }:
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; [
(pkgs.writeShellScriptBin "nrbs" "sudo nixos-rebuild switch") # (pkgs.writeShellScriptBin "nrbs" "sudo nixos-rebuild switch")
(pkgs.writeShellScriptBin "nrbsu" "sudo nix-channel --update && sudo nixos-rebuild switch") # (pkgs.writeShellScriptBin "nrbsu" "sudo nix-channel --update && sudo nixos-rebuild switch")
bash bash
busybox busybox
git git
@@ -35,4 +23,14 @@ in
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
}; };
users.users.${userSettings.username} = {
isNormalUser = true;
uid = 1000;
extraGroups = [ "wheel" "networkmanager" ];
openssh.authorizedKeys.keyFiles = [ /root/.ssh/authorized_keys ];
};
time.timeZone = "${systemSettings.timeZone}";
networking.hostName = systemSettings.hostName;
} }

16
flake.lock generated
View File

@@ -40,17 +40,18 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1733392399, "lastModified": 1733581040,
"narHash": "sha256-kEsTJTUQfQFIJOcLYFt/RvNxIK653ZkTBIs4DG+cBns=", "narHash": "sha256-Qn3nPMSopRQJgmvHzVqPcE3I03zJyl8cSbgnnltfFDY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d0797a04b81caeae77bcff10a9dde78bc17f5661", "rev": "22c3f2cf41a0e70184334a958e6b124fb0ce3e01",
"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,9 +64,10 @@
"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": {

View File

@@ -1,9 +1,9 @@
{ {
description = "Loki flake config"; description = "Panoptes 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";
@@ -16,50 +16,66 @@
nixpkgs, nixpkgs,
nixpkgs-stable, nixpkgs-stable,
home-manager, home-manager,
vscode-server,
... ...
} @ inputs: } @ inputs:
let let
stateVersion = "24.11";
inherit (self) outputs; inherit (self) outputs;
nixosSystem = inputs.nixpkgs.lib.nixosSystem;
userSettings = rec {
username = "panoptes";
gitUserName = "John Lancaster";
gitUserEmail = "32917998+jsl12@users.noreply.github.com";
# gitUserEmail = "asdfasdf@asdf.com";
};
systemSettings = rec {
hostName = "panoptes-nix";
system = "x86_64-linux"; system = "x86_64-linux";
timeZone = "America/Chicago"; timeZone = "America/Chicago";
hostname = "loki"; locale = "en_US.UTF-8";
lokiUser = "loki"; };
lokiPath = "/srv/loki";
pkgs = inputs.nixpkgs.legacyPackages.${systemSettings.system};
pkgs-stable = inputs.nixpkgs-stable.legacyPackages.${systemSettings.system};
in in
{ {
nixosConfigurations = { nixosConfigurations = {
# FIXME replace with your hostname "${systemSettings.hostName}" = nixosSystem {
${hostname} = nixpkgs.lib.nixosSystem { system = systemSettings.system;
system = "${system}"; specialArgs = {
# time.timeZone = "${timeZone}"; inherit inputs;
specialArgs = {inherit inputs outputs;}; inherit outputs;
inherit userSettings;
inherit systemSettings;
};
modules = [ modules = [
./configuration.nix # > Our main nixos configuration file < ./configuration.nix # > Our main nixos configuration file <
vscode-server.nixosModules.default "${inputs.nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
({ config, pkgs, ... }: {services.vscode-server.enable = true;}) ({ ... }: {
system.stateVersion = "${stateVersion}";
services.vscode-server.enable = true;
})
inputs.vscode-server.nixosModules.default
]; ];
}; };
}; };
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = { homeConfigurations = {
useGlobalPkgs = true; useGlobalPkgs = true;
"root@${hostname}" = home-manager.lib.homeManagerConfiguration { "panoptes@panoptes-nix" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system}; inherit pkgs stateVersion;
extraSpecialArgs = {inherit inputs outputs;}; specialArgs = {
modules = [(import ./git.nix { repoPath = "${lokiPath}"; })]; inherit inputs;
inherit outputs;
inherit userSettings;
inherit systemSettings;
}; };
# 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 = [ modules = [
(import ./home.nix { user = "${lokiUser}"; repoPath = "${lokiPath}"; }) ./home.nix
(import ./git.nix { repoPath = "${lokiPath}"; }) # ({...}: {home.stateVersion = "${stateVersion}";})
]; ];
}; };
}; };

10
git.nix
View File

@@ -1,10 +0,0 @@
{ repoPath, ... }:
{
programs.git = {
enable = true;
extraConfig.safe.directory = "${repoPath}";
extraConfig.credential.helper = "store --file ~/.git-credentials";
userName = "John Lancaster";
userEmail = "32917998+jsl12@users.noreply.github.com";
};
}

View File

@@ -1,9 +1,41 @@
{ user, repoPath, ... }:
{ {
pkgs,
systemSettings,
userSettings,
...
}:
let
homePath = "/srv/panoptes";
repoURL = "https://gitea.john-stream.com/john/loki-nix";
repoBranch = "reorg";
in
{
nixpkgs.config.allowUnfree = true;
programs.home-manager.enable = true; programs.home-manager.enable = true;
home = {
stateVersion = "24.05"; programs.git = {
username = "${user}"; enable = true;
homeDirectory = "${repoPath}"; extraConfig.credential.helper = "store --file ~/.git-credentials";
userName = "${userSettings.gitUserName}";
userEmail = "${userSettings.gitUserEmail}";
extraConfig.safe.directory = "${homePath}";
}; };
programs.bash.enable = true;
programs.ssh.enable = true;
home = {
homeDirectory = "${homePath}";
packages = [
(pkgs.writeShellScriptBin "nfs" ''
sudo nixos-rebuild switch --flake ${homePath}#${hostName} --impure
'')
(pkgs.writeShellScriptBin "init-panoptes" ''
sudo -u git clone -b ${repoBranch} ${repoURL} /srv/panoptes
'')
git
];
};
systemd.user.startServices = "sd-switch";
} }

19
nixosModules/default.nix Normal file
View File

@@ -0,0 +1,19 @@
{
pkgs,
config,
lib,
inputs,
outputs,
...
}: {
imports =
[
./services/loki.nix
];
config = {
nix.settings.experimental-features = ["nix-command" "flakes"];
programs.nix-ld.enable = true;
nixpkgs.config.allowUnfree = true;
};
}

View File

@@ -1,21 +1,22 @@
{ pkgs, userName, ... }: { pkgs, config, ... }:
let
lokiPort = 3100;
in
{ {
networking.firewall.allowedTCPPorts = [ lokiPort ]; networking.firewall.allowedTCPPorts = [
config.services.loki.configuration.server.http_listen_port
];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
(pkgs.writeShellScriptBin "loki-check" "curl http://localhost:3100/ready") (pkgs.writeShellScriptBin "loki-check" ''
(pkgs.writeShellScriptBin "loki-logs" "journalctl -b -u loki.service -n 25") curl http://localhost:${config.services.loki.configuration.server.http_listen_port}/ready
'')
(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 = 3100;
# server.grpc_listen_port = 9096; # server.grpc_listen_port = 9096;
auth_enabled = false; auth_enabled = false;

View File

@@ -1,14 +0,0 @@
{
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;
})
];
};
};
}