From 8649a521f6c6e073e75fb101f2546a016bb87dda Mon Sep 17 00:00:00 2001
From: Adrian Kummerlaender
Date: Mon, 2 Jan 2023 11:54:20 +0100
Subject: Flakeify build

---
 CMakeLists.txt |  6 ++++++
 flake.lock     | 27 +++++++++++++++++++++++++++
 flake.nix      | 27 +++++++++++++++++++++++++++
 shell.nix      | 20 --------------------
 4 files changed, 60 insertions(+), 20 deletions(-)
 create mode 100644 flake.lock
 create mode 100644 flake.nix
 delete mode 100644 shell.nix

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5b8b141..f0a7fe4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,3 +32,9 @@ target_compile_features(
 		cxx_std_17
 )
 
+install(
+	TARGETS
+		compustream
+	DESTINATION
+		bin
+)
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..42b6658
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,27 @@
+{
+  "nodes": {
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1659914493,
+        "narHash": "sha256-lkA5X3VNMKirvA+SUzvEhfA7XquWLci+CGi505YFAIs=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "022caabb5f2265ad4006c1fa5b1ebe69fb0c3faf",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixos-21.05",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "nixpkgs": "nixpkgs"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..9cd9e49
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,27 @@
+{
+  description = "compustream";
+
+  inputs = {
+    nixpkgs.url = github:NixOS/nixpkgs/nixos-21.05;
+  };
+
+  outputs = { self, nixpkgs, ... }: {
+    defaultPackage.x86_64-linux = let
+      system = "x86_64-linux";
+      pkgs = import nixpkgs { inherit system; };
+
+    in pkgs.stdenv.mkDerivation rec {
+      name = "compustream";
+
+      src = pkgs.lib.cleanSource ./.;
+
+      buildInputs = with pkgs; [
+        cmake
+        universal-ctags
+        glfw3
+        glew
+        glm
+      ];
+    };
+  };
+}
diff --git a/shell.nix b/shell.nix
deleted file mode 100644
index ce29a92..0000000
--- a/shell.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-{ pkgs ? import <nixpkgs> { }, ... }:
-
-pkgs.stdenvNoCC.mkDerivation rec {
-  name = "compustream-env";
-  env = pkgs.buildEnv { name = name; paths = buildInputs; };
-
-  buildInputs = with pkgs; [
-    cmake
-    universal-ctags
-    gcc8
-    gdb cgdb
-    glfw3
-    glew
-    glm
-  ];
-
-  shellHook = ''
-    export NIX_SHELL_NAME="${name}"
-  '';
-}
-- 
cgit v1.2.3