generated from john/nix-docker
Compare commits
37 Commits
a6348adef1
...
reorg_roun
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afe391ef8e | ||
|
|
fdb9d8717d | ||
|
|
857aedca79 | ||
|
|
3edc60fe84 | ||
|
|
7a1a40c2ae | ||
|
|
d22763540a | ||
|
|
fd21e90e1d | ||
|
|
138df54fbc | ||
|
|
30c43f5488 | ||
|
|
343c6a89db | ||
|
|
9334d2cc7f | ||
|
|
9d4c47682b | ||
|
|
e397231579 | ||
|
|
add8fca4b0 | ||
|
|
b973c002e1 | ||
|
|
6e891cc6da | ||
|
|
6dfa38cc5e | ||
|
|
b16ab9e230 | ||
|
|
fc2ef9344e | ||
|
|
50bb31a670 | ||
|
|
5233efa8ba | ||
|
|
ee521c87eb | ||
|
|
7667011dbf | ||
|
|
6bf90e6b24 | ||
|
|
36cf352c67 | ||
|
|
2a00037711 | ||
|
|
38c7effc93 | ||
|
|
fee9256b39 | ||
|
|
41bf8a074e | ||
|
|
68bfa4ef4b | ||
|
|
3121bffc30 | ||
|
|
a3179e52d7 | ||
|
|
679f8bfca0 | ||
|
|
f303b9ec57 | ||
|
|
dd3de3c145 | ||
|
|
d741b62d2c | ||
|
|
4e87f3119f |
@@ -1,22 +1,10 @@
|
||||
{ pkgs, lib, modulesPath, ... }:
|
||||
let
|
||||
stateVersion = "24.05";
|
||||
userName = "loki";
|
||||
repoPath = "/srv/loki";
|
||||
in
|
||||
{ pkgs, userSettings, systemSettings, ... }:
|
||||
{
|
||||
system.stateVersion = stateVersion;
|
||||
imports = [
|
||||
(modulesPath + "/virtualisation/proxmox-lxc.nix")
|
||||
];
|
||||
|
||||
# time.timeZone = "America/Chicago";
|
||||
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
(pkgs.writeShellScriptBin "nrbs" "sudo nixos-rebuild switch")
|
||||
(pkgs.writeShellScriptBin "nrbsu" "sudo nix-channel --update && sudo nixos-rebuild switch")
|
||||
# (pkgs.writeShellScriptBin "nrbs" "sudo nixos-rebuild switch")
|
||||
# (pkgs.writeShellScriptBin "nrbsu" "sudo nix-channel --update && sudo nixos-rebuild switch")
|
||||
bash
|
||||
busybox
|
||||
git
|
||||
@@ -35,4 +23,14 @@ in
|
||||
execWheelOnly = false;
|
||||
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
16
flake.lock
generated
@@ -40,17 +40,18 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1733392399,
|
||||
"narHash": "sha256-kEsTJTUQfQFIJOcLYFt/RvNxIK653ZkTBIs4DG+cBns=",
|
||||
"lastModified": 1733581040,
|
||||
"narHash": "sha256-Qn3nPMSopRQJgmvHzVqPcE3I03zJyl8cSbgnnltfFDY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d0797a04b81caeae77bcff10a9dde78bc17f5661",
|
||||
"rev": "22c3f2cf41a0e70184334a958e6b124fb0ce3e01",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"type": "indirect"
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
@@ -63,9 +64,10 @@
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.11",
|
||||
"type": "indirect"
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
|
||||
72
flake.nix
72
flake.nix
@@ -1,9 +1,9 @@
|
||||
{
|
||||
description = "Loki flake config";
|
||||
description = "Panoptes 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";
|
||||
@@ -16,50 +16,66 @@
|
||||
nixpkgs,
|
||||
nixpkgs-stable,
|
||||
home-manager,
|
||||
vscode-server,
|
||||
...
|
||||
} @ inputs:
|
||||
let
|
||||
stateVersion = "24.11";
|
||||
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";
|
||||
timeZone = "America/Chicago";
|
||||
hostname = "loki";
|
||||
lokiUser = "loki";
|
||||
lokiPath = "/srv/loki";
|
||||
locale = "en_US.UTF-8";
|
||||
};
|
||||
|
||||
pkgs = inputs.nixpkgs.legacyPackages.${systemSettings.system};
|
||||
pkgs-stable = inputs.nixpkgs-stable.legacyPackages.${systemSettings.system};
|
||||
|
||||
in
|
||||
{
|
||||
nixosConfigurations = {
|
||||
# FIXME replace with your hostname
|
||||
${hostname} = nixpkgs.lib.nixosSystem {
|
||||
system = "${system}";
|
||||
# time.timeZone = "${timeZone}";
|
||||
specialArgs = {inherit inputs outputs;};
|
||||
"${systemSettings.hostName}" = nixosSystem {
|
||||
system = systemSettings.system;
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
inherit outputs;
|
||||
inherit userSettings;
|
||||
inherit systemSettings;
|
||||
};
|
||||
modules = [
|
||||
./configuration.nix # > Our main nixos configuration file <
|
||||
vscode-server.nixosModules.default
|
||||
({ config, pkgs, ... }: {services.vscode-server.enable = true;})
|
||||
"${inputs.nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
|
||||
({ ... }: {
|
||||
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 = {
|
||||
useGlobalPkgs = true;
|
||||
"root@${hostname}" = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
extraSpecialArgs = {inherit inputs outputs;};
|
||||
modules = [(import ./git.nix { repoPath = "${lokiPath}"; })];
|
||||
"panoptes@panoptes-nix" = home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs stateVersion;
|
||||
specialArgs = {
|
||||
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 = [
|
||||
(import ./home.nix { user = "${lokiUser}"; repoPath = "${lokiPath}"; })
|
||||
(import ./git.nix { repoPath = "${lokiPath}"; })
|
||||
./home.nix
|
||||
# ({...}: {home.stateVersion = "${stateVersion}";})
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
10
git.nix
10
git.nix
@@ -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";
|
||||
};
|
||||
}
|
||||
42
home.nix
42
home.nix
@@ -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;
|
||||
home = {
|
||||
stateVersion = "24.05";
|
||||
username = "${user}";
|
||||
homeDirectory = "${repoPath}";
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
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
19
nixosModules/default.nix
Normal 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;
|
||||
};
|
||||
}
|
||||
@@ -1,21 +1,22 @@
|
||||
{ pkgs, userName, ... }:
|
||||
let
|
||||
lokiPort = 3100;
|
||||
in
|
||||
{ pkgs, config, ... }:
|
||||
{
|
||||
networking.firewall.allowedTCPPorts = [ lokiPort ];
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
config.services.loki.configuration.server.http_listen_port
|
||||
];
|
||||
|
||||
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:${config.services.loki.configuration.server.http_listen_port}/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;
|
||||
server.http_listen_port = 3100;
|
||||
# server.grpc_listen_port = 9096;
|
||||
auth_enabled = false;
|
||||
|
||||
14
vscode.nix
14
vscode.nix
@@ -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;
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user