Compare commits

...

18 Commits

Author SHA1 Message Date
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
8 changed files with 73 additions and 98 deletions

View File

@@ -3,8 +3,8 @@
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

36
flake.lock generated
View File

@@ -40,11 +40,11 @@
},
"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": {
@@ -71,18 +71,6 @@
}
},
"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=",
@@ -120,25 +108,9 @@
}
},
"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_3"
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1729422940,

View File

@@ -8,7 +8,8 @@
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
vscode-server.url = "path:./nixos/vscode";
# vscode-server.url = "path:./nixos/vscode";
vscode-server.url = "github:nix-community/nixos-vscode-server";
};
outputs = {
@@ -23,58 +24,48 @@
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
stateVersion = "24.05";
# userSettings = rec {
# username = "shahvirb"; # username on the system
# name = "Shahvir"; # name/identifier on the system
# email = "shahvirb@gmail.com";
# gitUserName = "shahvirb";
# gitUserEmail = "shahvirb@gmail.com";
# };
timeZone = "America/Chicago";
hostname = "loki";
lokiPort = 3100;
lokiUser = "loki";
lokiPath = "/srv/loki";
hostname = "panoptes-nix";
user = "panoptes";
in
{
nixosConfigurations = {
${hostname} = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./nixos/configuration.nix # > Our main nixos configuration file <
./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;
users.users.${user} = {
extraGroups = [ "wheel" ];
isNormalUser = true;
openssh.authorizedKeys.keyFiles = [ /root/.ssh/authorized_keys ];
};
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 ./home-manager/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-manager/home.nix { user = "${lokiUser}"; repoPath = "${lokiPath}"; })
(import ./home-manager/git.nix { repoPath = "${lokiPath}"; })
];
user = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {inherit inputs outputs pkgs;};
modules = [ ./homeManagerModules/home.nix ];
};
};
};

View File

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

View File

@@ -1,8 +1,7 @@
{ 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

@@ -0,0 +1,32 @@
{
inputs,
lib,
config,
pkgs,
...
}:
let
homePath = "/srv/panoptes";
in
{
imports = [ ./git.nix ];
programs.git.extraConfig.safe.directory = "${homePath}";
programs.home-manager.enable = true;
home = {
stateVersion = "24.05";
# username = "${user}";
homeDirectory = "${homePath}";
packages = [
(pkgs.writeShellScriptBin "nfs" ''
sudo nixos-rebuild switch --flake git+file://${homePath}#${hostname}
'')
(pkgs.writeShellScriptBin "init-panoptes" ''
sudo -u git clone -b reorg https://gitea.john-stream.com/john/loki-nix /srv/panoptes
'')
git
];
};
systemd.user.startServices = "sd-switch";
}

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;
})
];
};
};
}

View File

@@ -1,9 +1,13 @@
{ pkgs, lokiPort ? 3100, ... }:
{ 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:${builtins.toString lokiPort}/ready")
(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")
];
@@ -12,7 +16,7 @@
user = "loki";
configuration = {
server.http_listen_port = lokiPort;
server.http_listen_port = 3100;
# server.grpc_listen_port = 9096;
auth_enabled = false;