From e457c48757a7f39a591ea9e33d838ecdf04fe763 Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Tue, 9 Jul 2024 10:43:13 +0200 Subject: [PATCH 1/4] nix: basic system config --- flake.lock | 81 +++++++++++++++++++++++++++++++++- flake.nix | 23 ++++++++++ nix/default.nix | 1 + nix/infra.nix | 114 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 nix/infra.nix diff --git a/flake.lock b/flake.lock index ed5e17d..c4cbe4c 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,61 @@ { "nodes": { + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1720402389, + "narHash": "sha256-zJv6euDOrJWMHBhxfp/ay+Dvjwpe8YtMuEI5b09bxmo=", + "owner": "nix-community", + "repo": "disko", + "rev": "f1a00e7f55dc266ef286cc6fc8458fa2b5ca2414", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "nixlib": { + "locked": { + "lastModified": 1719708727, + "narHash": "sha256-XFNKtyirrGNdehpg7lMNm1skEcBApjqGhaHc/OI95HY=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "1bba8a624b3b9d4f68db94fb63aaeb46039ce9e6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixos-generators": { + "inputs": { + "nixlib": "nixlib", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1720055043, + "narHash": "sha256-SKizewU4UeYrkZWPUjur8EoxscGoNb0pGcrNL4YzAIg=", + "owner": "nix-community", + "repo": "nixos-generators", + "rev": "168b220231a70e47cc1f0919048fa5914415fb18", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-generators", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1720031269, @@ -18,7 +74,30 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "disko": "disko", + "nixos-generators": "nixos-generators", + "nixpkgs": "nixpkgs", + "srvos": "srvos" + } + }, + "srvos": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1720400448, + "narHash": "sha256-v7JVJ8H1PyH7/8EU72mz7wzxJ1OLE/h3NCqQyZ6ONjs=", + "owner": "nix-community", + "repo": "srvos", + "rev": "21a3259985e3cddc455f64ad66d4a825b39934ad", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "srvos", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 3a745d1..86fc059 100644 --- a/flake.nix +++ b/flake.nix @@ -3,9 +3,32 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixos-generators = { + url = "github:nix-community/nixos-generators"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + srvos = { + url = "github:nix-community/srvos"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs@{ self, nixpkgs, ... }: { + nixosConfigurations = { + main = nixpkgs.lib.nixosSystem rec { + system = "x86_64-linux"; + specialArgs = inputs; + modules = [ + ./nix/infra.nix + #inputs.srvos.nixosModules.server + inputs.nixos-generators.nixosModules.all-formats + ]; + }; + }; legacyPackages = nixpkgs.lib.attrsets.genAttrs nixpkgs.lib.systems.flakeExposed (system: import ./nix { inherit system inputs; pkgs = nixpkgs.legacyPackages.${system}; diff --git a/nix/default.nix b/nix/default.nix index 0dfc887..9be12ab 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -4,4 +4,5 @@ native = pkgs.callPackage ./native.nix {}; backend = pkgs.callPackage ./backend.nix {}; web = pkgs.callPackage ./web.nix {}; + docker = inputs.self.nixosConfigurations.main.config.formats.docker; } diff --git a/nix/infra.nix b/nix/infra.nix new file mode 100644 index 0000000..c2334e9 --- /dev/null +++ b/nix/infra.nix @@ -0,0 +1,114 @@ +{ + config, + lib, + pkgs, + self, + ... +}: + +{ + system.stateVersion = "24.11"; + nixpkgs.hostPlatform = { + system = "x86_64-linux"; + config = "x86_64-unknown-linux-gnu"; + }; + networking.hostName = "Main"; + time.timeZone = "Europe/Berlin"; + + xdg = { + mime.enable = true; + autostart.enable = true; + }; + + i18n = { + defaultLocale = "en_NZ.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + LC_CTYPE = "de_DE.UTF-8"; + LC_COLLATE = "de_DE.UTF-8"; + LC_MESSAGES = "en_NZ.UTF-8"; + }; + }; + + environment.variables = { + LOG_ICONS = "true"; + }; + + services.openssh = { + enable = true; + banner = "Hackers are in Your System!!!\n"; + settings = { + PasswordAuthentication = false; + PermitRootLogin = "prohibit-password"; + }; + }; + + fonts.fontDir.enable = true; + + networking.firewall.enable = lib.mkForce false; + + nix = { + settings = { + substituters = lib.mkForce [ + "https://cache.nixos.org" + "https://nix-community.cachix.org" + ]; + trusted-public-keys = lib.mkForce [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + trusted-users = [ "root" ]; + sandbox = true; + require-sigs = true; + max-jobs = "auto"; + auto-optimise-store = true; + allowed-users = [ "*" ]; + experimental-features = [ + "nix-command" + "flakes" + ]; + warn-dirty = true; + use-xdg-base-directories = true; + keep-going = true; + builders-use-substitutes = true; + }; + distributedBuilds = true; + package = pkgs.lix; + registry = lib.mkForce ((lib.mapAttrs (_: flake: { inherit flake; })) ((lib.filterAttrs (_: lib.isType "flake")) self.inputs) // { + self.flake = self; + }); + nixPath = lib.mkForce [ "/etc/nix/path" ]; + }; + + nixpkgs = { + config ={ + allowUnfree = true; + }; + }; + + environment.etc = lib.mapAttrs' (name: value: { name = "nix/path/${name}"; value.source = value.flake; }) config.nix.registry; + + services.postgresql.enable = true; + + users.users.master = { + isNormalUser = true; + shell = pkgs.nushell; + hashedPassword = "$2b$05$q5oW9Q25AjVAic1KY1xrIOZ6cyuleRxbsuMlW998lzOk6Us8Rplnq"; + extraGroups = [ "wheel" ]; + uid = 1000; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB8oyMpS2hK3gQXyHIIVS6oilgMpemLmfhKKJ6RBMwUh johannes@joens.email" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP3pKtvhOOjG1pGJq7cVHS5uWy5IP8y1Ra/ENpmJcqOe root@zap" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFEcNAVRN66mfKmaCpxs++0094Eh4mqXkUwDPZPkIIBB johannes@joens.email" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFZDUoC+1lNR2JTY1Q+vhXpuLmKMdVl2OMFLVbQ3cGkw jopejoe1@kuraokami" + ]; + }; +} From 129b0224e9c7f341bec1e7b4fdb75fe0ac98756c Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Tue, 9 Jul 2024 10:43:42 +0200 Subject: [PATCH 2/4] native: remove unused meson.build --- meson.build | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 meson.build diff --git a/meson.build b/meson.build deleted file mode 100644 index 7db2bfc..0000000 --- a/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -project( - 'lf2', - 'cpp' -) - -qt6 = import('qt6') -qt6_dep = dependency('qt6', modules: ['Core', 'Gui']) - -subdir('native') - From ae222173b127792ec851c9a9cd24a1ae8d8aea7e Mon Sep 17 00:00:00 2001 From: Mika Date: Tue, 9 Jul 2024 11:19:09 +0200 Subject: [PATCH 3/4] web: implemented login --- package.json | 1 + pnpm-lock.yaml | 9 +++ web/components.d.ts | 1 + web/package.json | 1 + web/pnpm-lock.yaml | 73 ++++++++++++++++++++++++ web/src/App.vue | 21 ++++--- web/src/components/CategoryContainer.vue | 3 +- web/src/components/HeaderBar.vue | 4 ++ web/src/components/ListViewElement.vue | 1 - web/src/components/StartPage.vue | 24 -------- web/src/components/loginPage.vue | 58 +++++++++++++++++++ web/src/store.ts | 8 +++ 12 files changed, 170 insertions(+), 34 deletions(-) create mode 100644 package.json create mode 100644 pnpm-lock.yaml delete mode 100644 web/src/components/StartPage.vue create mode 100644 web/src/components/loginPage.vue create mode 100644 web/src/store.ts diff --git a/package.json b/package.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/package.json @@ -0,0 +1 @@ +{} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..9b60ae1 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,9 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: {} diff --git a/web/components.d.ts b/web/components.d.ts index fb22071..e7cd53c 100644 --- a/web/components.d.ts +++ b/web/components.d.ts @@ -12,6 +12,7 @@ declare module 'vue' { HeaderBar: typeof import('./src/components/HeaderBar.vue')['default'] ListViewElement: typeof import('./src/components/ListViewElement.vue')['default'] ListViewTemplate: typeof import('./src/components/ListViewTemplate.vue')['default'] + LoginPage: typeof import('./src/components/loginPage.vue')['default'] SearchElement: typeof import('./src/components/SearchElement.vue')['default'] StartPage: typeof import('./src/components/StartPage.vue')['default'] TurboLogo: typeof import('./src/components/turboLogo.vue')['default'] diff --git a/web/package.json b/web/package.json index 7ffc629..1c233fd 100644 --- a/web/package.json +++ b/web/package.json @@ -8,6 +8,7 @@ }, "dependencies": { "@mdi/font": "6.2.95", + "axios": "^1.7.2", "lucide-vue-next": "^0.402.0", "roboto-fontface": "*", "vue": "^3.4.21", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index dea8bf5..9610ddb 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: '@mdi/font': specifier: 6.2.95 version: 6.2.95 + axios: + specifier: ^1.7.2 + version: 1.7.2 lucide-vue-next: specifier: ^0.402.0 version: 0.402.0(vue@3.4.31(typescript@5.5.3)) @@ -393,6 +396,12 @@ packages: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} + asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + + axios@1.7.2: + resolution: {integrity: sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==} + balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -411,6 +420,10 @@ packages: resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} + combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + computeds@0.0.1: resolution: {integrity: sha512-7CEBgcMjVmitjYo5q8JTJVra6X5mQ20uTThdK+0kR7UEaDrAWEQcRiBtWJzga4eRpP6afNwwLsX2SET2JhVB1Q==} @@ -429,6 +442,10 @@ packages: supports-color: optional: true + delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + entities@4.5.0: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} @@ -452,6 +469,19 @@ packages: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} + follow-redirects@1.15.6: + resolution: {integrity: sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + + form-data@4.0.0: + resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} + engines: {node: '>= 6'} + fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -515,6 +545,14 @@ packages: resolution: {integrity: sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==} engines: {node: '>=8.6'} + mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + + mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + minimatch@9.0.5: resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} engines: {node: '>=16 || 14 >=14.17'} @@ -551,6 +589,9 @@ packages: resolution: {integrity: sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==} engines: {node: ^10 || ^12 || >=14} + proxy-from-env@1.1.0: + resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} + queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -985,6 +1026,16 @@ snapshots: normalize-path: 3.0.0 picomatch: 2.3.1 + asynckit@0.4.0: {} + + axios@1.7.2: + dependencies: + follow-redirects: 1.15.6 + form-data: 4.0.0 + proxy-from-env: 1.1.0 + transitivePeerDependencies: + - debug + balanced-match@1.0.2: {} binary-extensions@2.3.0: {} @@ -1009,6 +1060,10 @@ snapshots: optionalDependencies: fsevents: 2.3.3 + combined-stream@1.0.8: + dependencies: + delayed-stream: 1.0.0 + computeds@0.0.1: {} csstype@3.1.3: {} @@ -1019,6 +1074,8 @@ snapshots: dependencies: ms: 2.1.2 + delayed-stream@1.0.0: {} + entities@4.5.0: {} esbuild@0.21.5: @@ -1065,6 +1122,14 @@ snapshots: dependencies: to-regex-range: 5.0.1 + follow-redirects@1.15.6: {} + + form-data@4.0.0: + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + mime-types: 2.1.35 + fsevents@2.3.3: optional: true @@ -1116,6 +1181,12 @@ snapshots: braces: 3.0.3 picomatch: 2.3.1 + mime-db@1.52.0: {} + + mime-types@2.1.35: + dependencies: + mime-db: 1.52.0 + minimatch@9.0.5: dependencies: brace-expansion: 2.0.1 @@ -1142,6 +1213,8 @@ snapshots: picocolors: 1.0.1 source-map-js: 1.2.0 + proxy-from-env@1.1.0: {} + queue-microtask@1.2.3: {} readdirp@3.6.0: diff --git a/web/src/App.vue b/web/src/App.vue index 7c83622..6c38321 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -1,13 +1,18 @@